[Javascript] thousand separator

Paul Novitski paul at novitskisoftware.com
Thu Jun 3 16:24:36 CDT 2004


At 01:22 PM 6/3/2004, Shawn Milo wrote:
>As for the comma versus period thou delimiter,
>I just decided to default to the period, and
>change it to a comma if the browser is reporting
>'us-en' (case insensitive).


Nice work so far.

The internationality still needs to be filled out if this widget is to pass 
for international.  For example, the Australian & Canadian thousands 
separator is the same comma as in the US, the French is a space, the Swiss 
(but which language?) is an apostrophe, and so on.  Therefore one might add:

         if (usTest.match(/en-(au|ca|us)/i)){ strThou = ',';}
         if (usTest.match(/fr-/i)){ strThou = ' ';}
         if (usTest.match(/-ch/i)){ strThou = "'";}
etc.

Also variable is the number of digits between separators: I've just learned 
that Chinese & Japanese separate every four digits with an ideograph 
representing 10000, and in India the lowest three digits are grouped, then 
every 2 digits after that!
http://www.xencraft.com/resources/multi-currency.html

In a word: yikes.

Now back to work!  *Crack!*

Paul 




More information about the Javascript mailing list