DelphiBasics
CurrToStr
Function
Convert a currency value to a string SysUtils unit
1 function CurrToStr(Value Currency):string;
2 function CurrToStr (Value Currency; const FormatSettings TFormatSettings:string;
Description
The CurrToStr function converts a currency Value into a displayable string.
 
The decimal point and digits are only displayed if non-zero. The CurrencyDecimals does not affect this function.
 
Unexpectedly, there is no currency symbol or thousands separator character used in the display.
 
Version 2 of this function is for use within threads. You furnish the FormatSettings record before invoking the call. It takes a local copy of global formatting variables that make the routine thread safe.
Notes
You can change the decimal point value by setting the DecimalSeparator character.

Use the CurrToStrF function for control over the formatting - especially with the TFloatFormat.ffCurrency formatting option.
Related commands
CurrToStrFConvert a currency value to a string with formatting
DecimalSeparatorThe character used to display the decimal point
StrToCurrConvert a number string into a currency value
 Download this web site as a Windows program.




 
Example code : Display currency values as strings
var
  amount1, amount2, amount3 : Currency;

begin
  amount1 := 1.23;
  amount2 := 123456789.1234;

  ShowMessage('Amount1 = '+CurrToStr(amount1));
  ShowMessage('Amount2 = '+CurrToStr(amount2));
end;
Show full unit code
  Amount1 = 1.23
  Amount2 = 123456789.1234
 
Delphi Programming © Neil Moffatt . All rights reserved.  |  Home Page