RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
SysUtils.TFormatSettings Record

TFormatSettings defines a thread-safe string formatting context.

Pascal
TFormatSettings = record
  CurrencyFormat: Byte;
  NegCurrFormat: Byte;
  ThousandSeparator: Char;
  DecimalSeparator: Char;
  CurrencyDecimals: Byte;
  DateSeparator: Char;
  TimeSeparator: Char;
  ListSeparator: Char;
  CurrencyString: string;
  ShortDateFormat: string;
  LongDateFormat: string;
  TimeAMString: string;
  TimePMString: string;
  ShortTimeFormat: string;
  LongTimeFormat: string;
  ShortMonthNames: array[1..12] of string;
  LongMonthNames: array[1..12] of string;
  ShortDayNames: array[1..7] of string;
  LongDayNames: array[1..7] of string;
  TwoDigitYearCenturyWindow: Word;
end;
C++
struct TFormatSettings {
  Byte CurrencyFormat;
  Byte NegCurrFormat;
  Char ThousandSeparator;
  Char DecimalSeparator;
  Byte CurrencyDecimals;
  Char DateSeparator;
  Char TimeSeparator;
  Char ListSeparator;
  AnsiString CurrencyString;
  AnsiString ShortDateFormat;
  AnsiString LongDateFormat;
  AnsiString TimeAMString;
  AnsiString TimePMString;
  AnsiString ShortTimeFormat;
  AnsiString LongTimeFormat;
  array[1..12] of string ShortMonthNames;
  array[1..12] of string LongMonthNames;
  array[1..7] of string ShortDayNames;
  array[1..7] of string LongDayNames;
  Word TwoDigitYearCenturyWindow;
};

SysUtils

TFormatSettings defines a data structure containing locale information used by string formatting routine. Each member of TFormatSettings is equivalent to the global variable with the same name. A variable of type TFormatSettings defines a thread-safe context that formatting functions can use in place of the default global context, which is not thread-safe. 

To create and use the thread-safe environment defined by TFormatSettings, follow these steps: 

Define a variable of type TFormatSettings 

Call GetLocaleFormatSettings to populate the TFormatSettings variable with locale information. 

Pass the TFormatSettings variable as the last parameter of the string formatting routine.  

Each routine that accepts a TFormatSettings parameter is thread-safe, and is an overload of an equivalent function that refers to the global formatting variables. 

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!