Description |
The CurrencyFormat variable is in effect an enumerated type. The values it can hold determine placement of the currency string in the currency display functions, such as CurrToStr.
The allowed values are :
0 | = Before amount |
1 | = After amount |
2 | = Before amount with space |
3 | = After amount with space |
|
|
Notes |
The CurrencyString variable determines the actual currency symbol or string. In the UK, the default is ?
CurrencyFormat = LOCALE_ICURRENCY by default.
|
|
Related commands |
CurrencyDecimals |
|
Defines decimal digit count in the Format function |
CurrencyString |
|
The currency string used in currency 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 |
ThousandSeparator |
|
The character used to display the thousands separator |
|
|
|
Example code : Illustrate the 4 currency formats |
// 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 CurrencyFormat 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;
i : Byte;
begin amount := 12; // 12 pounds
// Display the amount using all 4 currency formats
for i := 0 to 3 do
begin
CurrencyFormat := i;
ShowMessage('Format '+IntToStr(i)+' = '+CurrToStrF(amount, ffCurrency, 0));
end;
end;
end.
|
Hide full unit code |
Format 0 = ?12
Format 1 = 12?
Format 2 = ? 12
Format 3 = 12 ?
|
|