Description |
The ThousandSeparator variable is used in currency and floating point display functions.
ThousandSeparator value is ',' by default, but is dependent on your Windows locale.
|
|
Notes |
ThousandSeparator = LOCALE_STHOUSAND by default.
|
|
Related commands |
CurrencyDecimals |
|
Defines decimal digit count in the Format function |
CurrencyFormat |
|
Defines currency string placement in curr display functions |
CurrToStrF |
|
Convert a currency value to a string with formatting |
DecimalSeparator |
|
The character used to display the decimal point |
Format |
|
Rich formatting of numbers and text into a string |
NegCurrFormat |
|
Defines negative amount formatting in currency displays |
|
|
|
Example code : Changing the thousands separator character |
// Full Unit code. // ----------------------------------------------------------- // You must store this code in a unit called Unit1 with a form // called Form1 that has an OnCreate event called FormCreate. unit Unit1; interface uses SysUtils, // Unit containing the ThousandSeparator command Forms, Dialogs; type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); end; var Form1: TForm1; implementation {$R *.dfm} // Include form definitions procedure TForm1.FormCreate(Sender: TObject); var
amount : Currency;
begin amount := 1234567.89; // 1,234,567 pounds 89 pence
// Display with the default thousands separator
ShowMessage('Amount = '+FloatToStrF(amount, ffCurrency, 10, 2));
// Display with a new thousands separator
ThousandSeparator := ' ';
ShowMessage('Amount = '+FloatToStrF(amount, ffCurrency, 10, 2));
end; end.
|
Hide full unit code |
Amount = ?1,234,567.89
Amount = ?1 234 567.89
|
|