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
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
ThousandSeparator The character used to display the thousands separator
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 Download this web site as a Windows program.




 
Example code : Changing the currency character to a word
// 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 CurrencyString 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 := 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;
 
end.
Hide full unit code
   Amount = ?12
   Amount = 12 Pounds
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Home Page