FString
#include "Containers/UnrealString.h" Description
Unreal Engine's general-purpose heap-allocated string class. Stores a dynamically-sized, null-terminated array of TCHARs with full value semantics.
Caveats & Gotchas
- • FString uses TCHAR (UTF-16 on Windows). Always wrap string literals in TEXT("...") to avoid narrowing-conversion warnings and encoding mismatches.
- • FString has value semantics — assignment and copy both allocate new memory. Pass as const FString& or FStringView in function parameters to avoid unnecessary allocations.
- • The dereference operator *MyStr returns a raw TCHAR* to the internal buffer. This pointer is invalidated if the string is modified or destroyed.
Example
Create and concatenate strings C++
FString Name = TEXT("Alice");
FString Greeting = TEXT("Hello, ") + Name + TEXT("!");
UE_LOG(LogTemp, Log, TEXT("%s"), *Greeting); Functions (7)
Utility 7 ▼
| Access | Type | Name |
|---|---|---|
| public | function | FString::EndsWith |
| public | function | FString::StartsWith |
| public | function | FString::Contains |
| public | function | FString::Format |
| public | function | FString::Printf |
| public | function | FString::ToLower |
| public | function | FString::ToUpper |
See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?