Deprecated
'TFixedAnsiStringBuilder' is deprecated. Please use 'TAnsiStringBuilder' instead!
Module |
|
Header |
/Engine/Source/Runtime/Core/Public/Containers/StringFwd.h |
Include |
#include "Containers/StringFwd.h" |
template<typename CharType>
class TStringView
A fixed-size string builder for TCHAR. A fixed-size string builder for ANSICHAR.
String View
A string view is implicitly constructible from const char* style strings and from compatible character ranges such as FString and TStringBuilderBase.
A string view does not own any data nor does it attempt to control any lifetimes, it merely points at a subrange of characters in some other string. It's up to the user to ensure the underlying string stays valid for the lifetime of the string view.
A string view is cheap to copy and is intended to be passed by value.
A string view does not represent a NUL terminated string and therefore you should never pass in the pointer returned by GetData() into a C-string API accepting only a pointer. You must either use a string builder to make a properly terminated string, or use an API that accepts a length argument in addition to the C-string.
String views are a good fit for arguments to functions which don't wish to care which style of string construction is used by the caller. If you accept strings via string views then the caller is free to use FString, FStringBuilder, raw C strings, or any other type which can be converted into a string view.
The UE::String namespace contains many functions that can operate on string views. Most of these can be found in String/___.h in Core.
voidDoFoo(FStringViewInString);//DoFoomaybecalledas:voidMultiFoo(){FStringMyFoo(TEXT("Zoo"));constTCHAR*MyFooStr=*MyFoo;TStringBuilder<64>BuiltFoo;BuiltFoo.Append(TEXT("ABC"));DoFoo(MyFoo);DoFoo(MyFooStr);DoFoo(TEXT("ABC"));DoFoo(BuiltFoo);}
Name | Description | |
---|---|---|
|
TStringView() |
Construct an empty view. |
|
TStringView ( |
Construct a view of the null-terminated string pointed to by InData. |
|
TStringView ( |
Construct a view from a contiguous range of characters. |
|
TStringView ( |
Construct a view of InSize characters beginning at InData. |
Name | Description | ||
---|---|---|---|
|
constexpr co... |
begin() |
DO NOT USE DIRECTLY STL-like iterators to enable range-based for loop support. |
|
Compare ( |
Compare this view lexicographically with another view. |
|
|
Compare ( |
Compare this view lexicographically with another view. |
|
|
CopyString |
Copy characters from the view into a destination buffer without null termination. |
|
|
constexpr co... |
end() |
|
|
EndsWith ( |
Returns whether this view ends with the suffix character compared case-sensitively. |
|
|
EndsWith ( |
Returns whether this view ends with the suffix with optional case sensitivity. |
|
|
Equals ( |
Check whether this view is lexicographically equivalent to another view. |
|
|
Equals ( |
Check whether this view is lexicographically equivalent to another view. |
|
|
FindChar ( |
Search the view for the first occurrence of a character. |
|
|
FindLastChar ( |
Search the view for the last occurrence of a character. |
|
|
constexpr co... |
GetData() |
Returns a pointer to the start of the view. This is NOT guaranteed to be null-terminated! |
|
constexpr bo... |
IsEmpty() |
Returns whether the string view is empty. |
|
Left ( |
Returns the left-most part of the view by taking the given number of characters from the left. |
|
|
LeftChop ( |
Returns the left-most part of the view by chopping the given number of characters from the right. |
|
|
LeftChopInline ( |
Modifies the view by chopping the given number of characters from the right. |
|
|
LeftInline ( |
Modifies the view to be the given number of characters from the left. |
|
|
constexpr Si... |
Len() |
Returns the length of the string view. |
|
Mid |
Returns the middle part of the view by taking up to the given number of characters from the given position. |
|
|
MidInline |
Modifies the view to be the middle part by taking up to the given number of characters from the given position. |
|
|
RemovePrefix ( |
Modifies the view to remove the given number of characters from the start. |
|
|
RemoveSuffix ( |
Modifies the view to remove the given number of characters from the end. |
|
|
Reset() |
Resets to an empty view |
|
|
Right ( |
Returns the right-most part of the view by taking the given number of characters from the right. |
|
|
RightChop ( |
Returns the right-most part of the view by chopping the given number of characters from the left. |
|
|
RightChopInline ( |
Modifies the view by chopping the given number of characters from the left. |
|
|
RightInline ( |
Modifies the view to be the given number of characters from the right. |
|
|
StartsWith ( |
Returns whether this view starts with the prefix character compared case-sensitively. |
|
|
StartsWith ( |
Returns whether this view starts with the prefix with optional case sensitivity. |
|
|
SubStr |
Alias for Mid. |
|
|
TrimEnd() |
Returns the left part of the view before any whitespace at the end. |
|
|
TrimEndInline() |
Modifies the view to be the left part before any whitespace at the end. |
|
|
TrimStart() |
Returns the right part of the view after any whitespace at the start. |
|
|
TrimStartAndEnd() |
Returns the middle part of the view between any whitespace at the start and end. |
|
|
TrimStartAndEndInline() |
Modifies the view to be the middle part between any whitespace at the start and end. |
|
|
TrimStartInline() |
Modifies the view to be the right part after any whitespace at the start. |
Name | Description | ||
---|---|---|---|
|
const CharTy... |
operator[] ( |
Access the character at the given index in the view. |
Name |
Description |
---|---|
ElementType |
|
SizeType |
|
TIsCharRange |
Trait testing whether a type is a contiguous range of CharType, and not CharType[]. |
ViewType |