Formating decimal numbers with commas (1,000.00)

Stewart Gordon smjg_1998 at yahoo.com
Tue Sep 14 17:12:53 PDT 2010


On 14/09/2010 21:00, jicman wrote:
>
> 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.

Just wondering, where have you been searching for this information?

> I can write a little function to do this, but doesn't format already
> has this builtin?
<snip>

If the documentation
http://www.digitalmars.com/d/1.0/phobos/std_format.html
is to go by, there doesn't seem to be any such feature, and a quick look 
through the code doesn't reveal one either.

But there are many things std.format doesn't do.  I'd imagine that 
someone's written a more powerful number formatting library module, but 
I don't know of it.  Maybe that someone'll find this thread and 
enlighten us.

Stewart.


More information about the Digitalmars-d-learn mailing list