On Fri, Sep 12, 2008 at 9:01 AM, csnyder <[EMAIL PROTECTED]> wrote:
>
> On Wed, Sep 10, 2008 at 3:53 PM, Per Cederberg <[EMAIL PROTECTED]> wrote:
>
>> Suggested formatting types:
>> s - Output from toString(), this is the default
>> r - Output from MochiKit.Base.repr()
>> b - Binary. Outputs the number in base 2.
>> c - Character.
>> d - Decimal Integer. Outputs the number in base 10.
>> o - Octal format. Outputs the number in base 8.
>> x - Hex format. Outputs the number in base 16, using lower-case letters.
>> X - Hex format. Outputs the number in base 16, using upper-case letters.
>> f - Fixed point number.
>> % - Percent conversion for a fixed point number (and adds a '%' char
>> at the end).
>> ... perhaps some format for exponents (but it would be hard to implement)
>> ... and some nice time formatting stuff
>
> What about currency (amount) formatting?
>
> Or is that just "$"+format("{0:0.2d}", 1.6) ?
>
> It wasn't immediately clear to me from the examples how you get a
> precision 2 decimal number, which is likely to be one of the most
> requested formats.

d is for integers, f is for fixed point.

1> mochifmt:f("${0:.2f}", [1.234]).
"$1.23"

-bob

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to