(39) 's Extra Blueprint Nodes for You as a Plugin, No C++ Required!

Get Float As String With Precision Using Epic’s FText Helpers

Dear Community,

I’ve updated my Get Float As String With Precision node to

  1. Be pure (no exec chain)

  2. Utilize Epic’s FText C++ code to leverage of their hard work on float decimal precision.

  3. 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 is here: (about 8 mb) **

Enjoy!

:slight_smile: