Parse twitter-cldr-js formatted number back into integer or float?

232 views Asked by At

Is there any easy way to do reverse of:

// include twitter_cldr/es.js
var fmt = new TwitterCldr.DecimalFormatter();
fmt.format(1337); // "1.337"

i.e. parse "1.337" back to integer with value of 1337?

The solution should work for any twitter-cldr-js supported locale.

I am not looking for parseInt / parseFloat, as it does not handle all possible locales.

1

There are 1 answers

0
Peter Kilczuk On BEST ANSWER

After two days of trial & error I've found it impossible to do this using twitter-cldr-js and turned to Globalize instead, which does the job very neatly.