FormatCurr formats a floating point value.
function FormatCurr(const Format: string; Value: Extended): string;
FormatCurr formats the floating point value specified with Value. The format string passed in the Format parameter is used for this. An overview of the possibilities of format can be found here.
var S : String; c : Currency; begin c:=4563.2; S:=FormatCurr('###,##0.00',c); ShowMessage(s); end;
Rules to understand the script can be found here.
The value 4563.20 is assigned to the floating point variable c. The FormatCurr function converts this numeric value into a formatted text and assigns it to the variable S.
ShowMessage shows: 4,563.20
A maximum display of 999,999.99 was specified in the format mask. A total of 2 decimal places are rounded. If there are fewer decimal places, they are filled with 0. If the number is smaller than 0, at least one leading 0 is output. If the number is greater than 999.99, it is formatted with thousands separations.
Note that a dot must be entered in the script instead of a comma, since the representation in the script is always international. The same applies to the format mask.