UE4:基础数据

一.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

 

UE4:基础数据

上一篇:SQL入门经典(二) 之数据库基本查询、添加、更新和删除


下一篇:PVE 主机系统 Bond 网络配置示例