Like the title, say if I have a number “3”, the convert result should be “003”, if I have a number “33”, the convert result should be “033”, so on and so forth.
Right now I have a simple implementation like below
FText UFPWeaponInfo::IntToFText(int32 Num)
{
// TODO: Optimize the logic so it doesn't look as stupid as now.
if (Num >= 100)
{
return FText::FromString(FString::FromInt(Num));
}
else if (Num >= 10)
{
return FText::FromString(FString("0") + FString::FromInt(Num));
}
else
{
return FText::FromString(FString("00") + FString::FromInt(Num));
}
}
This works but it’s just too “stupid”, is there any better way to do this like a Format or something?