Formating decimal numbers with commas (1,000.00)

jicman cabrera_ at _wrc.xerox.com
Tue Sep 14 13:00:22 PDT 2010


Greetings.

I have been trying, for more than an hour, to get information on how to format a number (2342.23) to $2,342.23.  I can write a little function to do this, but doesn't format already has this builtin?  I searched for vsprintf(), printf, etc., and they all have a glyphic way of saying things.

I know that I can use,

real amt = 2342.23;
char[] z = format("%.2f",amt);

but, I want to do the $2,342.23.

Can anyone help a poor man? :-)

thanks,

josé


More information about the Digitalmars-d-learn mailing list