DelphiBasics
CurrencyFormat
Variable
Defines currency string placement in curr display functions SysUtils unit
var CurrencyFormat : Byte;
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 :
 
= Before amount
= After amount
= Before amount with space
= 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
CurrencyDecimalsDefines decimal digit count in the Format function
CurrencyStringThe currency string used in currency display functions
CurrToStrFConvert a currency value to a string with formatting
DecimalSeparatorThe character used to display the decimal point
FormatRich formatting of numbers and text into a string
NegCurrFormatDefines negative amount formatting in currency displays
ThousandSeparatorThe character used to display the thousands separator
 Download this web site as a Windows program.




 
Example code : Illustrate the 4 currency formats
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;

Show full unit code
  Format 0 = ?12
  Format 1 = 12?
  Format 2 = ? 12
  Format 3 = 12 ?
  
 
Delphi Programming © Neil Moffatt . All rights reserved.  |  Home Page