Navigation
API > API/Runtime > API/Runtime/Core > API/Runtime/Core/Containers
References
| Module | Core |
| Header | /Engine/Source/Runtime/Core/Public/Containers/StringConv.h |
| Include | #include "Containers/StringConv.h" |
template<typename To, int32 DefaultConversionSize, typename From>
auto StrCast
(
const From * Str,
int32 Len
)
Remarks
Creates an object which acts as a source of a given string type. See example above.
This is intended as the long-term replacement for StringCast, which doesn't cope well with zeros mid-string, which it can interpret as a null-terminators and give surprising behavior.
StrCast expects correctly-typed strings. If a cast is attempted with a char* or ANSICHAR*, and the string contains characters that are non-ASCII, including UTF-8 code units outside of the 7-bit ASCII range, then those values will fail to convert and a bogus char will be written in their place.
If a conversion from UTF-8 is desired, the pointer should be cast to UTF8CHAR* before being passed to StrCast.
Similarly, doing a StrCast
The source string must not be modified or destroyed until after the result of this function has been destroyed.
Parameters
| Name | Description |
|---|---|
| Str | A pointer to the start of the string to convert. Must be non-null if Len is non-zero. |
| Len | The number of From elements in Str. Must be non-negative. |