Is there a way to parse a string in javascript into a number with respect
to the locale
I'm editing a web based program at the moment. It is used all over the
globe. I'm adding a number based field. I want to be able to allow the end
user to enter in the number the way they want in their local locale. I see
that there is a function called Number.toLocaleString() that will give me
what I need. However, I can't seem to find an inverse function.
Take the string "1,000" for example. If my user's locale is US-en, I want
it to be interpreted as 1000. If my user's locale is DE-de then it should
be interpreted as 1. What is the standard way of doing this in JavaScript?
No comments:
Post a Comment