MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / FormatFloat

Method FormatFloat

Source/Editor/Utilities/Utils.cs:1053–1063  ·  view source on GitHub ↗

Format a float value either as-is, with a distance unit or with a degree sign. The value to format. The value type: none means just a number, distance will format in cm/m/km, angle with an appended degree sign. The formatted string.

(float value, FlaxEngine.Utils.ValueCategory category)

Source from the content-addressed store, hash-verified

1051 /// <param name="category">The value type: none means just a number, distance will format in cm/m/km, angle with an appended degree sign.</param>
1052 /// <returns>The formatted string.</returns>
1053 public static string FormatFloat(float value, FlaxEngine.Utils.ValueCategory category)
1054 {
1055 if (float.IsPositiveInfinity(value) || value == float.MaxValue)
1056 return "Infinity";
1057 if (float.IsNegativeInfinity(value) || value == float.MinValue)
1058 return "-Infinity";
1059 if (!Units.UseUnitsFormatting || category == FlaxEngine.Utils.ValueCategory.None)
1060 return FormatFloat(value);
1061 const string format = "G7";
1062 return InternalFormat(value, format, category);
1063 }
1064
1065 /// <summary>
1066 /// Format a double value either as-is, with a distance unit or with a degree sign

Callers 3

TestFormatFloatMethod · 0.80
UpdateTextMethod · 0.80
UpdateTextMethod · 0.80

Calls 4

SubstringMethod · 0.80
ToStringMethod · 0.45
IndexOfMethod · 0.45
ParseMethod · 0.45

Tested by 1

TestFormatFloatMethod · 0.64