Formating decimal numbers with commas (1,000.00)
jicman
cabrera_ at _wrc.xerox.com
Tue Sep 14 18:24:44 PDT 2010
Stewart Gordon Wrote:
> 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?
Google gave me a bunch of hits, but none where useful. I can go back and get them for you, but all they have is the man pages or documentation on *print*. PHP does have nice little functions (format_number, format_currency, etc.) that provide the results I want. I was hoping that doFormat would allow somekind of formatting such as:
doFormat("$%,.2f",1234.45);
and return $1,234,45. or something like that. Adding the $ at the beginning is easy. .-) Or,
doFormat("$10,.2f",1234.45);
would return
$ 1,234.56
where only 10 characters are allowed from the left side of the period back.
Anyway, you get what I am saying.
josé
More information about the Digitalmars-d-learn
mailing list