From Clomosy Docs

The FormatFloat function converts a numeric value (Double or Float) into a string according to the given Format string. The format string defines how the number will appear in the output. It can contain numeric formatting characters, optional placeholders, separators, scientific notation, percentages, and literal text.


Format Description
0 Mandatory digit Always shows a digit; if missing, filled with 0
# Optional digit Shows a digit if present; otherwise left blank
. Decimal separator Marks the decimal point (system locale dependent)
, Thousands separator Groups digits in thousands (system locale dependent)
E+00 / E-00 Scientific notation Shows the number in exponential format
% Percent Multiplies the number by 100 and adds a % sign
; Positive/negative separator Allows different formats for positive and negative numbers
'text' Literal text Displays the text exactly as written
\ Escape character Displays the next character literally


Example

var
    myNumber: Double;

{
    myNumber = 12345.6789;

    // Mandatory integer
    ShowMessage('0 = ' + FormatFloat('0', myNumber));

    // Two decimal places
    ShowMessage('0.00 = ' + FormatFloat('0.00', myNumber));

    // Optional decimal places
    ShowMessage('#.### = ' + FormatFloat('#.###', myNumber));

    // Thousands separator for integer
    ShowMessage('#,##0 = ' + FormatFloat('#,##0', myNumber));

    // Thousands separator + 2 decimals
    ShowMessage('#,##0.00 = ' + FormatFloat('#,##0.00', myNumber));

    // Percent format
    ShowMessage('0.00% = ' + FormatFloat('0.00%', myNumber/100));

    // Scientific notation
    ShowMessage('0.00E+00 = ' + FormatFloat('0.00E+00', myNumber));

    // Negative number format
    myNumber = -12345.6789;
    ShowMessage('0;(#) = ' + FormatFloat('0;(#)', myNumber));

    // Literal text
    myNumber = 42.5;
    ShowMessage('Value: 0.00 units = ' + FormatFloat('Value: 0.00 units', myNumber));
}

Output:

See Also