1. Home
  2. Computing & Technology
  3. Delphi Programming
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?
Explore Delphi Programming
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming

©2009 About.com, a part of The New York Times Company.

All rights reserved.