1. Computing & Technology
Glossary|Tips/Tricks|FREE App/VCL|Best'O'Net|Books|Link Back

Delphi Programming RTL Reference|By Category|Alphabetically|By Unit
 

TFormatSettings type

unit
SysUtils
category
Floating point conversion routines

declaration
type
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;

description
Defines a data structure containing locale information used by string formatting routines.

To create and use TFormatSettings, follow these steps:
1. Define a variable of type TFormatSettings
2. Call GetLocaleFormatSettings to populate the TFormatSettings variable with locale information.
3. Pass the TFormatSettings variable as the parameter of the string formatting routine.

example
var 
  s: string;
  fs : TFormatSettings; 

GetLocaleFormatSettings(0, fs);
fs.DecimalSeparator := 'D';
fs.ThousandSeparator := 'T';

s := FloatToStr(100 000 * PI, fs);

//s == '3T141T592D65'

in real code

see also
FloatToStr, GetLocaleFormatSettings,


 Free Delphi code snippet inside every Delphi Newsletter!
Subscribe to the Newsletter
Name
Email

 Got some code to share? Got a question? Need some help?

Discuss in my forum

©2012 About.com. All rights reserved.

A part of The New York Times Company.