Description |
The GetLocaleFormatSettings procedure gets the LCID Windows locale global variable values into a TFormatSettings record.
This record is used by the thread-safe versions of a number of data conversion functions - it must be furnished using this function before the conversion function is invoked.
|
|
Related commands |
CurrToStrF |
|
Convert a currency value to a string with formatting |
DateTimeToStr |
|
Converts TDateTime date and time values to a string |
FloatToStrF |
|
Convert a floating point value to a string with formatting |
Format |
|
Rich formatting of numbers and text into a string |
TFormatSettings |
|
A record for holding locale values for thread-safe functions |
|
|
|
|
Example code : Use of the format settings record |
// Full Unit code. // ----------------------------------------------------------- // You must store this code in a unit called Unit1 with a form // called Form1 that has an OnCreate event called FormCreate. unit Unit1; interface uses SysUtils, // Unit containing the GetLocaleFormatSettings command Windows, Forms, Dialogs; type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); end; var Form1: TForm1; implementation {$R *.dfm} // Include form definitions procedure TForm1.FormCreate(Sender: TObject); var
formatSettings : TFormatSettings;
begin // Furnish the locale format settings record
GetLocaleFormatSettings(LOCALE_SYSTEM_DEFAULT, formatSettings);
// And use it in the thread safe form of CurrToStrF
ShowMessage('1234.56 formats as = '+
CurrToStrF(1234.56, ffCurrency, 4, formatSettings));
end; end.
|
Hide full unit code |
1234.56 formats as ?1,234.5600
|
|