Back to website >

FormatFloatLCID (Pascalscript)


FormatFloatLCID formats a floating point value, taking into account the language-specific formatting of the specified LCID.

The way of formatting is read out by the operating system. Whether the specified LCID is supported or whether the desired result is obtained depends solely on the settings of the operating system. These can be viewed under "Control Panel/Region and Language Options".


function FormatFloatLCID(const Format: string; Value: Extended; LCID:Integer): string;


FormatFloat formats the floating point value specified with Value. The format string passed in the Format parameter is used for this. An overview of format options of format can be found here. The parameter LCID, which is also passed in this function, determines the country-specific formatting. This allows you, for example, to generate a floating point formatting for the French language area in a Windows set for Germany. Table LCID gives you all values defined in Windows.


  S : String;
  e : Extended;

Rules to understand the script can be found here.

The value 4563.2 is assigned to the floating point variable e. The FormatFloatLCID function converts this numerical value into a formatted text and assigns it to the variable S. In this example, 1033 stands for an"English (US)" specific output.

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.