DelphiBasics
GetLocaleFormatSettings
Procedure
Gets locale values for thread-safe functions SysUtils unit
 procedure GetLocaleFormatSettings(LCID Integer; var FormatSettings TFormatSettings);
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
CurrToStrFConvert a currency value to a string with formatting
DateTimeToStrConverts TDateTime date and time values to a string
FloatToStrFConvert a floating point value to a string with formatting
FormatRich formatting of numbers and text into a string
TFormatSettingsA record for holding locale values for thread-safe functions
 Download this web site as a Windows program.




 
Example code : Use of the format settings record
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;
Show full unit code
  1234.56 formats as ?1,234.5600
 
Delphi Programming © Neil Moffatt . All rights reserved.  |  Home Page