Dear Community,
I’ve updated my Get Float As String With Precision node to
-
Be pure (no exec chain)
-
Utilize Epic’s FText C++ code to leverage of their hard work on float decimal precision.
-
Add bool to make the leading 0 optional, so 0.5 could be shown as 0.5 or .5 depending on your preferences!
Yay!
**My C++ Code For You!**
Here's how it works in C++ !
```
void UVictoryBPFunctionLibrary::StringConversion__GetFloatAsStringWithPrecision(float TheFloat, FString & FloatString, uint8 Precision, bool IncludeLeadingZero)
{
FNumberFormattingOptions NumberFormat; //Text.h
NumberFormat.MinimumIntegralDigits = **(IncludeLeadingZero) ? 1 : 0;**
NumberFormat.MaximumIntegralDigits = 10000;
NumberFormat.MinimumFractionalDigits = **Precision;**
NumberFormat.MaximumFractionalDigits = **Precision; **
FloatString = FText::AsNumber(**TheFloat**, &NumberFormat).ToString();
}
```
**Latest plugin download on the UE4 Wiki: (15.22 mb) **
**Victory Plugin on Media Fire**
If your browser is not updating the Wiki download page to the most recent version, you can use my alternative Media Fire download link!
Please note clicking link will not start a download instantly, it will just take you to the Media Fire file description.
https://www.mediafire.com/?g6uf9kt5ueb2upj
Note on Packaging Victory Plugin
Enjoy!