Hi! I have a bunch of numbers I show in the browser's locale using Number.toLocaleString(). In France for example the ',' is going to be used as a separator. My issue is that those fields are input/output and I need to convert the user data back to number, and Number(string) will not recognize the ',' -> NAN. I do not see any symmetrical operation to toLocaleString() that would let me do that (something like NumberFormat.parseLocaleString(string). Before I do my own regexp, I just want to make sure I'm not missing something. Thanks! Claude
You can try replacing ',' with '.' Number( string.replace(',', '.') ); If there is '.' instead of ',' nothing is replaced.