currency formatting and string manipulation

wxdqz

New Member
I want to display localized prices (using javascript). Currency format is different for different countries. Luckily I want to display currencies, only in France, Germany, UK and US.

Any inputs on how do i take care of formatting my price depending on a locale? Had it been java, it was much simpler.

String Manipulation: ?
I need to break a string in a particular pattern, and store the broken pieces into an array:
(two chars), (two chars), ... . . . . (three chars), (two chars)

Please suggest the simplest way to do this. While loop and a sequence of "if" statements is the obvious solution. Can any one make use of "split" or "regular expression" some how and solve it ?

example1:
1293878334
output:
(1)(29)(38)(783)(34)

example2:
12334
output:
(123)(34)

example3:
334
output:
(3)(34)

Thanks in advance.
~aapun
 
Back
Top