Description |
The NegCurrFormat variable defines how negative currency amounts are formatted by such functions as FloatToStr and CurrToStr.
It is in effect an enumerated type, but with no names for the values. It is easiest to show their meanings by example, given below with an amount 1.23 and ? as the CurrencyString:
?0 | = (?1.23) |
?1 | = -?1.23 |
?2 | = ?-1.23 |
?3 | = ?1.23- |
?4 | = (1.23?) |
?5 | = -1.23? |
?6 | = 1.23-? |
?7 | = 1.23?- |
?8 | = -1.23 ? |
?9 | = -? 1.23 |
10 | = 1.23 ?- |
11 | = ? 1.23- |
12 | = ? -1.23 |
13 | = 1.23- ? |
14 | = (? 1.23) |
15 | = (1.23 ?) |
|
|
Notes |
NegCurrFormat = LOCALE_INEGCURR 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 |
ThousandSeparator |
|
The character used to display the thousands separator |
|
|
|
Example code : Illustrate the 16 different negative formatting flavours |
// 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 NegCurrFormat 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
i : Byte;
begin // Display the amount using all the flavours of NegCurrFormat
for i := 0 to 15 do
begin
NegCurrFormat := i;
ShowMessage('Format '+IntToStr(i)+' = '+Format('%m', [-1.23]));
end;
end; end.
|
Hide full unit code |
Format 0 = (?1.23)
Format 1 = -?1.23
Format 2 = ?-1.23
Format 3 = ?1.23-
Format 4 = (1.23?)
Format 5 = -1.23?
Format 6 = 1.23-?
Format 7 = 1.23?-
Format 8 = -1.23 ?
Format 9 = -? 1.23
Format 10 = 1.23 ?-
Format 11 = ? 1.23-
Format 12 = ? -1.23
Format 13 = 1.23- ?
Format 14 = (? 1.23)
Format 15 = (1.23 ?)
|
|