You are here: Scripting Reference > Functions > Formatting > FormatFloat

FormatFloat

Declaration

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

Example

procedure OnMapEvent(var Value:Variant);

var MyAmount : double;

begin

MyAmount := 123.4567;

Value := FormatFloat('#0.00', MyAmount); //Value will be equal to '123.46'

end;

Description

FormatFloat converts a Float into a String data type, using a provided Format. If the format provides for less decimal places than the value it will round to that number of decimal places.

 

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