一.FString

.FString<->Array



1.FString->Array
FString JsonStr;
TArray<uint8> content;

content.SetNum(JsonStr.Len());
memcpy(content.GetData(), TCHAR_TO_ANSI(*JsonStr), JsonStr.Len());

2.Array->FString
TArray<uint8> content
...
const std::string cstr(reinterpret_cast<const char*>(content.GetData()), content.Num());
UE_LOG(VRSLog, Warning, TEXT("%s"), *frameAsFString);


 

.FString<->FText



1.FString->FText
FString Str = Text("str");
FText Text = FText::FromString(Str);

2.FText->FString
FString Name = NameDesc->GetText().ToString();


 

.FString<->std::string



1.FString->std::string
#include <string>
...
FString UE4Str = "Flowers";
std::string MyStdString(TCHAR_TO_UTF8(*UE4Str));

2.std::string->FString
#include <string>
...
std::string TestString = "Happy";
FString HappyString(TestString.c_str());


 

 

二.FText