Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NumberFormat.prototype.parse method #147

Closed
everdimension opened this issue Jun 3, 2017 · 1 comment
Closed

NumberFormat.prototype.parse method #147

everdimension opened this issue Jun 3, 2017 · 1 comment

Comments

@everdimension
Copy link

everdimension commented Jun 3, 2017

Had anyone thought that it might be very useful to have a NumberFormat.prototype.parse which does the opposite of format?

It can be very useful to know how a certain formatted number can be parsed since in different locales different symbols (such as decimal marks) can have different meaning.

So for example:

new Intl.NumberFormat('ja-JP', { style: 'currency', currency: 'JPY' }).format(123456.789)
// '¥123,457'

new Intl.NumberFormat('ja-JP').parse('¥123,457')
// would return something like { currency: 'JPY', value: 123457 }
@littledan
Copy link
Member

See related issue at #1 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants