FString filePath
UE_LOG(LogTemp, Log, TEXT("%s"), *filePath);
UE_LOG(LogTemp, Error, TEXT("Hello,World!"));
FString filePath;
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, FString::Printf(TEXT("DLL_Init")));
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, FString::Printf(TEXT("%s"), *filePath));
FString TheString = "UE4_C++_IS_Awesome";
FName ConvertedFString = FName(*TheString);
#include
//....
std::string TestString = "Happy";
FString HappyString(TestString.c_str());
#include
//....
FString UE4Str = "Flowers";
std::string MyStdString(TCHAR_TO_UTF8(*UE4Str));
FString TheString = "123.021";
int32 MyShinyNewInt = FCString::Atoi(*TheString);
FString TheString = "123.021";
int32 MyShinyNewInt = FCString::Atof(*TheString);
FString NewString = FString::FromInt(YourInt);
FString VeryCleanString = FString::SanitizeFloat(YourFloat);
CString.h
UnrealString.h
NameTypes.h
StringConv.h (TCHAR_TO_ANSI etc)
CString.h可以查到更多,如
atoi64 (string to int64)
Atod (string to double precision float)
更多关于FString的操作可以到UnrealString.h找到.
uint8 data[512];
FMemory::Memzero(data, 512);
FMemory::Memcpy(data, ArrayReaderPtr->GetData(), ArrayReaderPtr->Num());
FString str = ((const char*)data);
TArray content;
...
const std::string cstr(reinterpret_cast<const char*>(content.GetData()), content.Num());
FString frameAsFString = cstr.c_str();
UE_LOG(VRSLog, Warning, TEXT("%s"), *frameAsFString);
FString JsonStr;
TArray content;
content.SetNum(JsonStr.Len());
memcpy(content.GetData(), TCHAR_TO_ANSI(*JsonStr), JsonStr.Len());
FString StrData;
const TCHAR* StrPtr = *StrData;
FTCHARToUTF8 UTF8String(StrPtr);
int32 CTXSize = UTF8String.Length();
TArray URLData;
URLData.SetNum(CTXSize);
memcpy(URLData.GetData(), UTF8String.Get(), CTXSize);
///1
FString str
string t = TCHAR_TO_UTF8(*str);
char * returnvalue = (char *)malloc(sizeof(char) * (t.length() + 1));
strncpy_s(returnvalue, t.length() , t.c_str(), t.length());
///2
int ARPG_Database::BP_GetColumnIndex(int resultSet, FString columnName)
{
return GetColumnIndex(resultSet, TCHAR_TO_ANSI(*columnName));
}
int ARPG_Database::GetColumnIndex(int iResult, const char* columnName)
{
}
const char *plainText= TCHAR_TO_ANSI(*aes_content);
int ARPG_Database::BP_GetColumnIndex(int resultSet, FString columnName)
{
return GetColumnIndex(resultSet, *columnName);
}
int ARPG_Database::GetColumnIndex(int iResult, const TCHAR* columnName)
{
}
FString Str = TEXT("str");
FText Text = FText::FromString(Str);
FString Name = NameDesc->GetText().ToString();
Logs, Printing Messages To Yourself During Runtime
UEngine::AddOnScreenDebugMessage
String Conversions: FString to FName, FString to Int32, Float to FString
字符编码
String Casting Fun in Unreal Engine 4 UPDATED