DelphiBasics
CurrencyString
Variable
The currency string used in currency display functions SysUtils unit
var CurrencyString : string;
Description
The CurrencyString variable is used in currency display functions. It is used to prefix or suffix the currency amount.
 
For example, the UK default is ?, so 1.23 is displayed as ?1.23 by default.
Notes
The CurrencyFormat value determines whether the currency string is placed before or after the amount, and whether a space is placed between it and the amount.

CurrencyString = LOCALE_SCURRENCY by default.
Related commands
CurrencyDecimalsDefines decimal digit count in the Format function
CurrencyFormatDefines currency string placement in curr 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 : Changing the currency character to a word
var
  amount : Currency;

begin
  amount := 12;    // 12 pounds

  // Display with the default currency string
  ShowMessage('Amount = '+CurrToStrF(amount, ffCurrency, 0));

  // Display with the currency shown as a word after the amount
  CurrencyString := 'Pounds';
  CurrencyFormat := 4;    // 4 means after with a space
  ShowMessage('Amount = '+CurrToStrF(amount, ffCurrency, 0));
end;
Show full unit code
  Amount = ?12
  Amount = 12 Pounds
 
Delphi Programming © Neil Moffatt . All rights reserved.  |  Home Page