1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| FString string = "string"; FName fname = FName(*string); TCHAR tchar = *string; FText ftext = FText::FromString(string); std::string cstring(TCHAR_TO_UTF8(*string)); FString numberString = "1234.123"; int32 strint = FCString::Atoi(*numberString); float strfloat = FCString::Atof(*numberString); bool strBool = string.ToBool();
TArray<uint8> uint8Array; uint8Array.SetNum(string.len()); memcpy(uint8Array.GetData(), TCHAR_TO_ANSI(*string), string.Len());
TArray<uint8> content; const std::string cstr(reinterpret_cast<const char*>(content.GetData()), content.Num()); FString frameAsFString = cstr.c_str();
std::string cstring = "cstring"; FString fromCstring(cstring.c_str());
FString fromFText = ftext.ToString(); FStirng fromFName = fname.ToString(); Fstring fromfloat = FString::SanitizeFloat(strfloat); FString fromint = FString::FromInt(IntVariable); FString frombool = InBool ? TEXT("true") : TEXT("false"); FString fromFVector = VectorVariable.ToString(); FString fromFVector2D = Vector2DVariable.ToString(); FString fromFRotator = RotatorVariable.ToString(); FString fromFLinerColor = LinearColorVariable.ToString(); FString fromUObject = (InObj != NULL) ? InObj->GetName() : FString(TEXT("None"));
|