Navigation
API > API/Runtime > API/Runtime/Core > API/Runtime/Core/Containers
References
| Module | Core |
| Header | /Engine/Source/Runtime/Core/Public/Containers/UnrealString.h.inl |
| Include | #include "Containers/UnrealString.h.inl" |
Syntax
class UE_STRING_CLASS
Remarks
A dynamically sizeable string. When dealing with UTF-8 literals, the following advice is recommended:
- Do not use the u8"..." prefix (gives the wrong array type until C++20).
- Use UTF8TEXT("...") for array literals (type is const UTF8CHAR[n]).
- Use UTF8TEXTVIEW("...") for string view literals (type is FUtf8StringView).
- Use \uxxxx or \Uxxxxxxxx escape sequences rather than \x to specify Unicode code points.
Variables
| Type | Name | Description | |
|---|---|---|---|
| int32 bool | bAllowShrinking | ||
| bool | bAllowShrinking | ||
| int32 | Count | ||
| int32 | ExtraSlack | ||
| const ANSICHAR * | Str | ||
| const WIDECHAR * | Str | ||
| const UTF8CHAR * | Str | ||
| const UCS2CHAR * | Str |
Constructors
| Type | Name | Description | |
|---|---|---|---|
UE_STRING_CLASS
(
const UE_STRING_CLASS& Other, |
Create a copy of the Other string with extra space for characters at the end of the string | ||
UE_STRING_CLASS
(
UE_STRING_CLASS&& Other, |
Create a copy of the Other string with extra space for characters at the end of the string | ||
UE_STRING_CLASS
(
CharRangeType&& Str, |
Construct from contiguous range of characters with extra slack on top of original string length | ||
UE_STRING_CLASS
(
const UE_STRING_CLASS& |
|||
UE_STRING_CLASS
(
const ANSICHAR* Str |
Construct from null-terminated C string or nullptr | ||
UE_STRING_CLASS
(
const WIDECHAR* Str |
|||
UE_STRING_CLASS
(
const UTF8CHAR* Str |
|||
UE_STRING_CLASS
(
const UCS2CHAR* Str |
|||
UE_STRING_CLASS
(
CharRangeType&& Str |
Construct from contiguous range of characters such as a string view or string builder | ||
Functions
| Type | Name | Description | |
|---|---|---|---|
| UE_STRING_CLASS & | Append
(
CharRangeType&& Str |
Append a string and return a reference to this | |
| UE_STRING_CLASS & | Append a string and return a reference to this | ||
| UE_STRING_CLASS & | Append
(
CharType* Str |
Append a valid null-terminated string and return a reference to this | |
| UE_STRING_CLASS & | AppendChar
(
ElementType InChar |
Append a single character and return a reference to this | |
| void | AppendChars
(
const ANSICHAR* Str, |
Appends a character range without null-terminators in it | |
| void | AppendChars
(
const WIDECHAR* Str, |
||
| void | AppendChars
(
const UCS2CHAR* Str, |
||
| void | AppendChars
(
const UTF8CHAR* Str, |
||
| UE_STRING_CLASS & | Appendf
(
const FmtType& Fmt, |
Just like Printf, but appends the formatted text to the existing string instead. | |
| void | Appends the integer InNum to this string | ||
| void | AutoRTFMAssignFromOpenToClosed
(
UE_STRING_CLASS& Closed, |
||
| DataType::RangedForIteratorType | begin () |
DO NOT USE DIRECTLY STL-like iterators to enable range-based for loop support. | |
| DataType::RangedForConstIteratorType | begin () |
||
| void | Run slow checks on this string | ||
| UE_STRING_CLASS | Chr
(
ElementType Ch |
Returns a string containing only the Ch character | |
| UE_STRING_CLASS | ChrN
(
int32 NumCharacters, |
Returns a string that is full of a variable number of characters | |
| int32 | Compare
(
const UE_STRING_CLASS& Other, |
Lexicographically tests how this string compares to the Other given string | |
| UE_STRING_CLASS | ConstructFromPtrSize
(
const UCS2CHAR* Str, |
||
| UE_STRING_CLASS | ConstructFromPtrSize
(
const WIDECHAR* Str, |
||
| UE_STRING_CLASS | ConstructFromPtrSize
(
const ANSICHAR* Str, |
Construct from a buffer. | |
| UE_STRING_CLASS | ConstructFromPtrSize
(
const UTF8CHAR* Str, |
||
| UE_STRING_CLASS | ConstructFromPtrSizeWithSlack
(
const ANSICHAR* Str, |
Construct from a buffer with extra slack on top of original string length. | |
| UE_STRING_CLASS | ConstructFromPtrSizeWithSlack
(
const WIDECHAR* Str, |
||
| UE_STRING_CLASS | ConstructFromPtrSizeWithSlack
(
const UTF8CHAR* Str, |
||
| UE_STRING_CLASS | ConstructFromPtrSizeWithSlack
(
const UCS2CHAR* Str, |
||
| UE_STRING_CLASS | ConstructWithSlack
(
const UCS2CHAR* Str, |
||
| UE_STRING_CLASS | ConstructWithSlack
(
const ANSICHAR* Str, |
Construct from null-terminated C string with extra slack on top of original string length. | |
| UE_STRING_CLASS | ConstructWithSlack
(
const WIDECHAR* Str, |
||
| UE_STRING_CLASS | ConstructWithSlack
(
const UTF8CHAR* Str, |
||
| bool | Contains
(
const ElementType* SubStr, |
Returns whether this string contains the specified substring. | |
| bool | Contains
(
CharRangeType&& SubStr, |
Returns whether this string contains the specified substring. | |
| bool | Contains
(
const UE_STRING_CLASS& SubStr, |
Returns whether this string contains the specified substring. | |
| bool | Contains
(
const ElementType* SubStr, |
Returns whether this string contains the specified substring. | |
| UE_STRING_CLASS | ConvertTabsToSpaces
(
const int32 InSpacesPerTab |
Replaces all instances of '\t' with TabWidth number of spaces | |
| UE_STRING_CLASS | ConvertTabsToSpaces
(
const int32 InSpacesPerTab |
Replaces all instances of '\t' with TabWidth number of spaces | |
| void | ConvertTabsToSpacesInline
(
const int32 InSpacesPerTab |
Replaces all instances of '\t' with TabWidth number of spaces | |
| void | CountBytes
(
FArchive& Ar |
||
| TConstIterator | Creates a const iterator for the characters in this string | ||
| TIterator | Creates an iterator for the characters in this string | ||
| int32 | CullArray
(
TArray< UE_STRING_CLASS >* InArray |
Takes an array of strings and removes any zero length entries. | |
| void | |||
| void | Empty () |
Create empty string of given size with zero terminating character | |
| DataType::RangedForConstIteratorType | end () |
||
| DataType::RangedForIteratorType | end () |
||
| bool | EndsWith
(
CharRangeType&& InSuffix, |
Test whether this string ends with given suffix. | |
| bool | EndsWith
(
const ElementType* InSuffix, |
Test whether this string ends with given suffix. | |
| bool | EndsWith
(
const UE_STRING_CLASS& InSuffix, |
Test whether this string ends with given suffix. | |
| bool | EndsWith
(
const ElementType* InSuffix, |
Test whether this string ends with given suffix. | |
| bool | Equals
(
const UE_STRING_CLASS& Other, |
Lexicographically tests whether this string is equivalent to the Other given string | |
| int32 | Find
(
CharRangeType&& SubStr, |
Searches the string for a substring, and returns index into this string of the first found instance. | |
| int32 | Find
(
const ElementType* SubStr, |
Searches the string for a substring, and returns index into this string of the first found instance. | |
| int32 | Find
(
const UE_STRING_CLASS& SubStr, |
Searches the string for a substring, and returns index into this string of the first found instance. | |
| int32 | Find
(
const ElementType* SubStr, |
Searches the string for a substring, and returns index into this string of the first found instance. | |
| bool | FindChar
(
ElementType InChar, |
Searches the string for a character | |
| bool | FindLastChar
(
ElementType InChar, |
Searches the string for the last occurrence of a character | |
| int32 | FindLastCharByPredicate
(
Predicate Pred |
Searches the string for the last occurrence of a character which matches the specified predicate. | |
| int32 | FindLastCharByPredicate
(
Predicate Pred, |
Searches an initial substring for the last occurrence of a character which matches the specified predicate. | |
| UE_STRING_CLASS | Format
(
const ElementType* InFormatString, |
Format the specified string using the specified arguments. | |
| UE_STRING_CLASS | Format
(
const ElementType* InFormatString, |
Format the specified string using the specified arguments. | |
| UE_STRING_CLASS | FormatAsNumber
(
int32 InNumber |
Takes the number passed in and formats the string in comma format ( 12345 becomes "12,345") | |
| UE_STRING_CLASS | Converts a buffer to a string | ||
| UE_STRING_CLASS | FromHexBlob
(
const uint8* SrcBuffer, |
Converts a buffer to a string by hex-ifying the elements | |
| UE_STRING_CLASS | Converts an integer to a string. | ||
| SIZE_T | |||
| const DataType & | GetCharArray () |
Get string as const array of TCHARS | |
| DataType & | GetCharArray () |
Get string as array of TCHARS | |
| void | InsertAt
(
int32 Index, |
||
| void | InsertAt
(
int32 Index, |
||
| bool | IsEmpty () |
Test whether this string is empty | |
| bool | IsNumeric () |
Returns true if the string only contains numeric characters | |
| bool | IsValidIndex
(
int32 Index |
Tests if index is valid, i.e. greater than or equal to zero, and less than the number of characters in this string (excluding the null terminator). | |
| UE_STRING_CLASS | Join
(
const RangeType& Range, |
Joins a range of 'something that can be concatentated to strings with +=' together into a single string with separators. | |
| UE_STRING_CLASS | JoinBy
(
const RangeType& Range, |
Joins a range of elements together into a single string with separators using a projection function. | |
| UE_STRING_CLASS | Returns the left most given number of characters | ||
| UE_STRING_CLASS | |||
| UE_STRING_CLASS | Returns the left most characters from the string chopping the given number of characters from the end | ||
| UE_STRING_CLASS | |||
| void | LeftChopInline
(
int32 Count, |
Modifies the string such that it is now the left most characters chopping the given number of characters from the end | |
| void | LeftInline
(
int32 Count, |
Modifies the string such that it is now the left most given number of characters | |
| UE_STRING_CLASS | Pad the left of this string for ChCount characters | ||
| int32 | Len () |
Get the length of the string, excluding terminating character | |
| bool | MatchesWildcard
(
const UE_STRING_CLASS& Wildcard, |
Searches this string for a given wild cardThis is a simple, SLOW routine. Use with caution | |
| bool | MatchesWildcard
(
CharRangeType&& Wildcard, |
Searches this string for a given wild cardThis is a simple, SLOW routine. Use with caution | |
| bool | MatchesWildcard
(
const ElementType* Wildcard, |
Searches this string for a given wild cardThis is a simple, SLOW routine. Use with caution | |
| bool | MatchesWildcard
(
const ElementType* Wildcard, |
Searches this string for a given wild cardThis is a simple, SLOW routine. Use with caution | |
| UE_STRING_CLASS | |||
| UE_STRING_CLASS | Returns the substring from Start position to the end | ||
| UE_STRING_CLASS | |||
| UE_STRING_CLASS | Returns the substring from Start position for Count characters. | ||
| void | MidInline
(
int32 Start, |
Modifies the string such that it is now the substring from Start position for Count characters. | |
| SIZE_T | |||
| SIZE_T | |||
| int32 | ParseIntoArray
(
TArray< UE_STRING_CLASS >& OutArray, |
Breaks up a delimited string into elements of a string array. | |
| int32 | ParseIntoArray
(
TArray< UE_STRING_CLASS >& OutArray, |
Breaks up a delimited string into elements of a string array, using the given delimiters | |
| int32 | ParseIntoArrayLines
(
TArray< UE_STRING_CLASS >& OutArray, |
Breaks up a delimited string into elements of a string array, using line ending characters | |
| int32 | ParseIntoArrayWS
(
TArray< UE_STRING_CLASS >& OutArray, |
Breaks up a delimited string into elements of a string array, using any whitespace and an optional extra delimter, like a "," | |
| void | PathAppend
(
const ElementType* Str, |
Concatenate this path with given path ensuring the / character is used between them | |
| UE_STRING_CLASS | Printf
(
const FmtType& Fmt, |
Constructs a string similarly to how classic sprintf works. | |
| DataType::RangedForConstReverseIteratorType | rbegin () |
||
| DataType::RangedForReverseIteratorType | rbegin () |
||
| void | RemoveAt
(
int32 Index, |
Removes characters within the string. | |
| void | RemoveAt
(
int32 Index, |
Removes a character from the string. | |
| bool | RemoveFromEnd
(
const ElementType* InSuffix, |
Removes the text from the end of the string if it exists. | |
| bool | RemoveFromEnd
(
const UE_STRING_CLASS& InSuffix, |
Removes the text from the end of the string if it exists. | |
| bool | RemoveFromEnd
(
const ElementType* InSuffix, |
Removes the text from the end of the string if it exists. | |
| bool | RemoveFromEnd
(
CharRangeType&& InSuffix, |
Removes the text from the end of the string if it exists. | |
| bool | RemoveFromStart
(
const ElementType* InPrefix, |
Removes the text from the start of the string if it exists. | |
| bool | RemoveFromStart
(
const UE_STRING_CLASS& InPrefix, |
Removes the text from the start of the string if it exists. | |
| bool | RemoveFromStart
(
const ElementType* InPrefix, |
Removes the text from the start of the string if it exists. | |
| bool | RemoveFromStart
(
CharRangeType&& InPrefix, |
Removes the text from the start of the string if it exists. | |
| void | Removes spaces from the string. I.E. "Spaces Are Cool" --> "SpacesAreCool". | ||
| DataType::RangedForConstReverseIteratorType | rend () |
||
| DataType::RangedForReverseIteratorType | rend () |
||
| UE_STRING_CLASS | Replace
(
const ElementType* From, |
Replace all occurrences of a substring in this string | |
| UE_STRING_CLASS | Replace
(
const ElementType* From, |
Replace all occurrences of a substring in this string | |
| void | ReplaceCharInline
(
ElementType SearchChar, |
Replace all occurrences of a character with another.no dynamic allocation | |
| UE_STRING_CLASS | ReplaceCharWithEscapedChar
(
const TArray< ElementType >* Chars |
Replaces certain characters with the "escaped" version of that character (i.e. replaces "\n" with "\n"). | |
| UE_STRING_CLASS | ReplaceCharWithEscapedChar
(
const TArray< ElementType >* Chars |
Replaces certain characters with the "escaped" version of that character (i.e. replaces "\n" with "\n"). | |
| void | ReplaceCharWithEscapedCharInline
(
const TArray< ElementType >* Chars |
Replaces certain characters with the "escaped" version of that character (i.e. replaces "\n" with "\n"). | |
| UE_STRING_CLASS | ReplaceEscapedCharWithChar
(
const TArray< ElementType >* Chars |
Removes the escape backslash for all supported characters, replacing the escape and character with the non-escaped version. | |
| UE_STRING_CLASS | ReplaceEscapedCharWithChar
(
const TArray< ElementType >* Chars |
Removes the escape backslash for all supported characters, replacing the escape and character with the non-escaped version. | |
| void | ReplaceEscapedCharWithCharInline
(
const TArray< ElementType >* Chars |
Removes the escape backslash for all supported characters, replacing the escape and character with the non-escaped version. | |
| int32 | ReplaceInline
(
const ElementType* SearchText, |
Replace all occurrences of SearchText with ReplacementText in this string. | |
| UE_STRING_CLASS | Returns a copy of this string with all quote marks escaped (unless the quote is already escaped) | ||
| UE_STRING_CLASS | Returns a copy of this string with all quote marks escaped (unless the quote is already escaped) | ||
| void | To allow more efficient memory handling, automatically adds one for the string termination. | ||
| void | Empties the string, but doesn't change memory allocation, unless the new size is larger than the current string. | ||
| UE_STRING_CLASS | Reverse () |
Returns this string, with the characters in reverse order | |
| UE_STRING_CLASS | Reverse () |
Returns a copy of this string, with the characters in reverse order | |
| void | Reverses the order of characters in this string | ||
| UE_STRING_CLASS | Returns the string to the right of the specified location, counting back from the right (end of the word). | ||
| UE_STRING_CLASS | |||
| UE_STRING_CLASS | Returns the string to the right of the specified location, counting forward from the left (from the beginning of the word). | ||
| UE_STRING_CLASS | |||
| void | RightChopInline
(
int32 Count, |
Modifies the string such that it is now the string to the right of the specified location, counting forward from the left (from the beginning of the word). | |
| void | RightInline
(
int32 Count, |
Modifies the string such that it is now the right most given number of characters | |
| UE_STRING_CLASS | Pad the right of this string for ChCount characters | ||
| UE_STRING_CLASS | SanitizeFloat
(
double InFloat, |
Converts a float string with the trailing zeros stripped For example - 1.234 will be "1.234" rather than "1.234000" | |
| void | SerializeAsANSICharArray
(
FArchive& Ar, |
Serializes a string as ANSI char array. | |
| void | Shrink () |
Remove unallocated empty character space from the end of this string | |
| bool | Split
(
const UE_STRING_CLASS& InS, |
Splits this string at given string position case sensitive. | |
| bool | Split
(
const UE_STRING_CLASS& InS, |
Split with ESearchCase::IgnoreCase and ESearchDir::FromStart. | |
| bool | StartsWith
(
const ElementType* InPrefix, |
Test whether this string starts with given prefix. | |
| bool | StartsWith
(
const UE_STRING_CLASS& InPrefix, |
Test whether this string starts with given prefix. | |
| bool | StartsWith
(
const ElementType* InPrefix, |
Test whether this string starts with given prefix. | |
| bool | StartsWith
(
CharRangeType&& InPrefix, |
Test whether this string starts with given prefix. | |
| bool | ToBlob
(
const UE_STRING_CLASS& Source, |
Converts a string into a buffer | |
| bool | ToBool () |
Converts a string into a boolean value 1, "True", "Yes", FCoreTexts::True, FCoreTexts::Yes, and non-zero integers become true 0, "False", "No", FCoreTexts::False, FCoreTexts::No, and unparsable values become false | |
| bool | ToHexBlob
(
const UE_STRING_CLASS& Source, |
Converts a string into a buffer | |
| UE_STRING_CLASS | ToLower () |
Converts all characters in this rvalue string to lowercase and moves it into the returned string. | |
| UE_STRING_CLASS | ToLower () |
Returns a new string with the characters of this converted to lowercase | |
| void | Converts all characters in this string to lowercase | ||
| UE_STRING_CLASS | ToUpper () |
Converts all characters in this rvalue string to uppercase and moves it into the returned string. | |
| UE_STRING_CLASS | ToUpper () |
Returns a new string with the characters of this converted to uppercase | |
| void | Converts all characters in this string to uppercase | ||
| UE_STRING_CLASS | TrimChar
(
ElementType CharacterToTrim, |
Returns a copy of this string with wrapping CharacterToTrim removed (removes at max one instance in the beginning and end of the string). | |
| UE_STRING_CLASS | TrimChar
(
ElementType CharacterToTrim, |
Returns a copy of this string with wrapping CharacterToTrim removed (removes at max one instance in the beginning and end of the string). | |
| void | TrimCharInline
(
ElementType CharacterToTrim, |
Trims a single character from the start and end of the string (removes at max one instance in the beginning and end of the string). | |
| UE_STRING_CLASS | TrimEnd () |
Removes whitespace characters from the end of this string. | |
| UE_STRING_CLASS | TrimEnd () |
Removes whitespace characters from the end of this string. | |
| void | Removes whitespace characters from the end of this string. Modifies the string in-place. | ||
| UE_STRING_CLASS | TrimQuotes
(
bool* bQuotesRemoved |
Returns a copy of this string with wrapping quotation marks removed. | |
| UE_STRING_CLASS | TrimQuotes
(
bool* bQuotesRemoved |
Returns this string with wrapping quotation marks removed. | |
| void | TrimQuotesInline
(
bool* bQuotesRemoved |
Trims wrapping quotation marks from this string. | |
| UE_STRING_CLASS | TrimStart () |
Removes whitespace characters from the start of this string. | |
| UE_STRING_CLASS | TrimStart () |
Removes whitespace characters from the start of this string. | |
| UE_STRING_CLASS | Removes whitespace characters from the start and end of this string. | ||
| UE_STRING_CLASS | Removes whitespace characters from the start and end of this string. | ||
| void | Removes whitespace characters from the start and end of this string. Modifies the string in-place. | ||
| void | Removes whitespace characters from the start of this string. Modifies the string in-place. | ||
| void | Trims the inner array after the null terminator. |
Operators
| Type | Name | Description | |
|---|---|---|---|
| bool | operator!=
(
const CharType* Rhs |
Lexicographically test whether the left string is != the right stringcase insensitive | |
| bool | operator!=
(
const UE_STRING_CLASS& Rhs |
Lexicographically test whether the left string is != the right stringcase insensitive | |
| const ElementType * | operator* () |
Get pointer to the string | |
| UE_STRING_CLASS & | operator/=
(
const ElementType* Str |
Concatenate this path with given path ensuring the / character is used between them | |
| UE_STRING_CLASS & | operator/=
(
CharRangeType&& Str |
Concatenate this path with given path ensuring the / character is used between them | |
| UE_STRING_CLASS & | operator/=
(
const CharType* Str |
Concatenate this path with given path ensuring the / character is used between them | |
| ElementType & | operator[]
(
int32 Index |
Return specific character from this string | |
| const ElementType & | operator[]
(
int32 Index |
Return specific const character from this string | |
| decltype(Append(Forward< StrType >(Str))) | operator+=
(
StrType&& Str |
Append a string and return a reference to this | |
| UE_STRING_CLASS & | operator+=
(
AppendedCharType Char |
Append a single character and return a reference to this | |
| UE_STRING_CLASS & | operator=
(
UE_STRING_CLASS&& |
||
| UE_STRING_CLASS & | operator=
(
const UE_STRING_CLASS& |
||
| UE_STRING_CLASS & | operator=
(
const ElementType* Str |
End - intrusive TOptional |
|
| UE_STRING_CLASS & | operator=
(
CharRangeType&& Range |
||
| bool | |||
| bool | operator==
(
const UE_STRING_CLASS& Rhs |
Lexicographically test whether the left string is == the right stringcase insensitive | |
| bool | operator==
(
const CharType* Rhs |
Lexicographically test whether the left string is == the right stringcase insensitive |
Typedefs
| Name | Description |
|---|---|
| AllocatorType | |
| DataType | Array holding the character data |
| ElementType | |
| FmtCharType | |
| IntrusiveUnsetOptionalStateType | |
| TConstIterator | |
| TIsCharEncodingCompatibleWithPrintfFmt | Like the TIsCharEncodingCompatibleWithTCHAR trait, but for the element type of the string |
| TIterator | Iterator typedefs |
Constants
| Name | Description |
|---|---|
| bHasIntrusiveUnsetOptionalState | Start - intrusive TOptional |
Deprecated Functions
| Type | Name | Description | |
|---|---|---|---|
UE_ALLOWSHRINKING_BOOL_DEPRECATED
(
"RemoveAt" |
|||
UE_ALLOWSHRINKING_BOOL_DEPRECATED
(
"LeftInline" |
|||
UE_ALLOWSHRINKING_BOOL_DEPRECATED
(
"LeftChopInline" |
|||
UE_ALLOWSHRINKING_BOOL_DEPRECATED
(
"RightInline" |
|||
UE_ALLOWSHRINKING_BOOL_DEPRECATED
(
"RightChopInline" |
|||
UE_ALLOWSHRINKING_BOOL_DEPRECATED
(
"MidInline" |
|||
|
Construct from null-terminated C string or nullptr with extra slack on top of original string length | ||
|
|||
|
|||
|
|||
|
|||
|
Construct from null-terminated C substring or nullptr | ||
|
|||
|
See Also
https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/StringHandling/FString/