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
CurrencyFormat Defines currency string placement in curr display functions
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
 Author links

 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 2002 - 2020. All rights reserved.  |  Home Page