SmartPascal
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
CurrToStrF Convert a currency value to a string with formatting
DecimalSeparator The character used to display the decimal point
StrToCurr Convert a number string into a currency value
 
Example code : Display currency values as strings
// 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 CurrToStr 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
  amount1, amount2, amount3 : Currency;

begin
  amount1 := 1.23;
  amount2 := 123456789.1234;

  ShowMessage('Amount1 = '+CurrToStr(amount1));
  ShowMessage('Amount2 = '+CurrToStr(amount2));
end;
 
end.
Hide full unit code
   Amount1 = 1.23
   Amount2 = 123456789.1234