Board index » delphi » Currency to String with decimals

Currency to String with decimals

Hi,

Does anyone know how to convert Currency to String and maintain the two
decimals ($0.00)?

Thanks in advance.

 

Re:Currency to String with decimals


Quote
Jane Scarano wrote:

> Hi,

> Does anyone know how to convert Currency to String and maintain the two
> decimals ($0.00)?

> Thanks in advance.

Look at FmtStr...

Re:Currency to String with decimals


Try this one:

{ CurrencyToString
  ----------------
  formats a float into a currency string for the locale. This will
  only work with currencies using two decimal places
  but will need amending for places such as Italy etc.
  You need to change the parameters to FloatToStrF. }
function CurrencyToString(Value: extended): AnsiString;
begin
        result := FloatToStrF(value, ffCurrency, 10, 2);
end;

Other Threads