This content has been marked as final.
Show 3 replies
-
1. Re: [JS] Convertion String to nomber (decimal)
Philippe Ruelle Feb 15, 2011 12:07 PM (in response to Philippe Ruelle)var test ='12,3'
alert(test.replace(',','.'));
OK
Thank
Il n'y a pas une function?
There is not a function?
-
2. Re: [JS] Convertion String to nomber (decimal)
[Jongware]-9BC6tI Feb 15, 2011 1:17 PM (in response to Philippe Ruelle)Il n'y a pas une function?
Non; in fact, most programming languages are hardcoded to US conventions. But the overhead of doing the replace when necessary is tiny.
You might have a similar problem if someone enters a number with thousands separators: "12.500,0" If you replace the comma with a period, "parseFloat("12.500.00")" will happily read the number, all the way up to the next 'invalid' character, which is the second period. And then it will return "12.5" ...
-
3. Re: [JS] Convertion String to nomber (decimal)
Philippe Ruelle Feb 15, 2011 1:39 PM (in response to [Jongware]-9BC6tI)Ok
Thank you and good evening or good day


