You need to sign in to do that
Don't have an account?
james2000
Invalid Double exception when parsing comma in string
It looks like the Double.valueOf(String) and Decimal.valueOf(String) don't support using a non-decimal point separator. For many locales, the decimal separator character is the comma (,) instead of period (.). When I call Double.valueOf(String) in a locale that uses a comma, I expect it to parse correctly. Unfortunately, this isn't the case.
For example, the following code will throw a TypeException:
Double d = Double.valueOf('7,2');
System.debug('D=' + d.format());
Changing the "," to "." works though.
Is this expected behavior? I'm guessing the only thing I can do is replace "," with "." whenever parsing a string. :smileysad: