[thelist] javascript question on formatting numbers.

Rory.Plaire at wahchang.com Rory.Plaire at wahchang.com
Thu Dec 20 17:15:09 CST 2001


+| of course there's always the NumberFormat() function which 
+| lets you specify
+| any number of leading zeros, along with comma and decimal 
+| point placement,
+| etc., but no one has taken the time to write one that i've 
+| found.  *grin*
+| maybe i'll do that real soon now(tm)
+| 
+| .jeff

I was lookin' at the same thing this morn'.

http://developer.irt.org/script/6.htm

this is a good start.

I'd like to modify it to put the silly commas (or dots) back in... since
that is what the excel-financial heads like. 

oooh, i feel a tip commin'

<tip type="ColdFusion and L10N" author="rory">
In ColdFusion, there are a number of functions for localization of your
app... (localization -- a.k.a L10N... wanna know why? count the letters
between 'i' and 'n', and see if you get 10. if not, i spelled it wrong. same
logic with I18N and internationalization. 8)

These functions are prefixed by 'LS' and allow you to format numbers and
dates to conform to local standards around the world. European numbers, for
instance, have commas for the U.S. decimal and periods for the U.S.
thousands separator. 

Coldfusion formats all the apps values' using these functions appropriately
depending on the locale that the user selects.
</tip>

<rory disposition="nothin' like a good thread on evolt to give me an excuse
to something other than my project work" alt="8}"/>




More information about the thelist mailing list