You need to sign in to do that
Don't have an account?
Mak One
To convert String to number according to locale (opposite of .toLocaleString)
I am getting numbers in respective language in Visualforce page from controller. Now I have to do fast calculations using those numbers. I am using javascript for that. Now, the problem is ho to read those numbers if user changes it. Suppose it is in Hindi.3500 will be displayed as ३,५०० and user can change it to ३,५५५ (3555). So what can I use to convert ३,५५५ to 3555.
If I do:
var number = 3500;
alert(number.toLocaleString("hi-IN"));
I will get ३,५०० in Hindi.
But how can I convert it back to 3500. I want something like:
var str='३,५००';
alert(str.toLocaleNumber("en-US"));
So, that it can give 3500.
Is it possible by javascript, jquery or any other free or paid library?
I tried jquery.numberformatter which is not working for this.
If I do:
var number = 3500;
alert(number.toLocaleString("hi-IN"));
I will get ३,५०० in Hindi.
But how can I convert it back to 3500. I want something like:
var str='३,५००';
alert(str.toLocaleNumber("en-US"));
So, that it can give 3500.
Is it possible by javascript, jquery or any other free or paid library?
I tried jquery.numberformatter which is not working for this.
var number = 3500;
alert(number.toLocaleString("hi-IN"));
I will get ३,५०० in Hindi.
var str='३,५००';
alert(str.toLocaleNumber("en-US"));
So, that it can give 3500.
If your problem can solved please select my answer as best answer
You can do this by creatinf your own function.
You can refer below code:
If this solves your problem, kindly mark it as the best answer.
Thanks,
Vatsal