You need to sign in to do that
Don't have an account?

parse decimal bug?
Why following code does not work in Sweden locale?
Decimal d = 12345.67;
String s = d.format();
Decimal dd = Decimal.valueof(s); // throws 'System.TypeException: Invalid decimal: 12 345,67'
Basically I need an unformat method that works as reverse of format and works for any locale.
Try this.
I know this would work. But what I need is to display numbers formatted according to user's locale (thus use format()), and be able to parse numbers entered by user in their locale.
try this.
Thanks, but it does not work, first it still chokes on space (the thousand separator), second I cannot remove comma, because it is the decimal point in Sweden locale.
This would work for Sweden locale, but what I need is code that works for any locale.
I guess this would work for all locales.
Hi - did you ever get a sensible answer to this problem? i.e. one that didn't rely on string manipulation to replace commas, spaces and dots.