FormatFloat converts a float-point or fixed-point value into a String data type, using a Format Specifier.

If the format provides for less decimal places than is contained within the input variable value, it will round to the number of decimal places specified.

This is commonly used when you need to build a String and concatenate a Float value.

Please refer to Format Specifiers for information and examples regarding the many format options available for FormatFloat.

Declaration: Function FormatFloat( const Format : string; Value : Extended) : string

An example of the use of FormatFloat follows.

procedure OnMapEvent(var Value:Variant);
var MyAmount : double;
begin
MyAmount := 123.4567;
Value := FormatFloat('#0.00', MyAmount); //Value will be equal to '123.46'
Value := FormatFloat('#0.0000', MyAmount); //Value will be equal to '123.4567'
Value := FormatFloat('0', MyAmount); //Value will be equal to '123'
end;