September 15, 2010 Re: Formating decimal numbers with commas (1,000.00) | ||||
---|---|---|---|---|
| ||||
Posted in reply to jicman | jicman:
> Way over my head. :-) Thanks, though.
It's not that complex. Try to comment out most of the code and add some prints. IsType is a recursive template missing in Phobos2 too, it returns true if the first type is any of the following ones, you may remove it if you aren't able to write it.
Bye,
bearophile
|
September 15, 2010 Re: Formating decimal numbers with commas (1,000.00) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stewart Gordon | On Tue, 14 Sep 2010 20:12:53 -0400, Stewart Gordon <smjg_1998@yahoo.com> 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?
>
>> 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.
I believe Tango has an extensive locale library which does this sort of thing.
-Steve
|
Copyright © 1999-2021 by the D Language Foundation