DelphiBasics
CurrencyDecimals
Variable
Defines decimal digit count in the Format function SysUtils unit
var CurrencyDecimals : Byte;
Description
The CurrencyDecimals variable provides a default number of decimal digits for the Format and related functions.
Notes
CurrencyDecimals = LOCALE_ICURRDIGITS by default.
Related commands
CurrencyFormatDefines currency string placement in curr display functions
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 : Change the default decimal digits from 2 to 4
var
  amount : Double;

begin
  amount := 1234.567;

  // Display the amount using the default decimal digits (2)
  ShowMessage('Amount = '+Format('%m', [amount]));

  // Redisplay the amount with 4 decimal digits
  CurrencyDecimals := 4;
  ShowMessage('Amount = '+Format('%m', [amount]));
end;
Show full unit code
  Amount = ?1,234.57
  Amount = ?1,234.5670
 
Delphi Programming © Neil Moffatt . All rights reserved.  |  Home Page