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

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

GetLocaleFormatSettings procedure

unit
SysUtils
category
String formatting routines
declaration
procedure GetLocaleFormatSettings(LCID: Integer; var FormatSettings: TFormatSettings);
description
Populates a TFormatSettings data structure based on the Windows locale ID.

To find out about specific values for LCID search msdn.microsoft.com for "Locales & Languages". To get the system default locale send the LOCALE_SYSTEM_DEFAULT constant (or LOCALE_USER_DEFAULT). Here are some locale ID's (decimal value):

  • Croatian: 1050
  • English_United_States: 1033
  • French_Standard: 1036
  • Slovenian: 1060
  • German_Standard: 1031
example
var 
  s: string;
  fs : TFormatSettings; 

GetLocaleFormatSettings(LOCALE_SYSTEM_DEFAULT, fs);
s := FloatToStr(100 000 * PI, fs);
//s == '3,141,592.65'

fs.DecimalSeparator := 'D';
fs.ThousandSeparator := 'T';
s := FloatToStr(100 000 * PI, fs);
//s == '3T141T592D65'


in real code
see also
FloatToStr,


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?

©2014 About.com. All rights reserved.