Hi,

I’m currently working though some of the examples and encountered a problem:

Code like this:
nextValue = Double.valueOf(df.format(nextValue));

Seems to not work correctly in Germany as we have a “,” as decimal separator 
and “.” as grouping character.
This results numbers like “10,3” being passed into Double.valueOf which causes 
exceptions.

If I change it to this:

try {
    nextValue = df.parse(df.format(nextValue)).doubleValue();
} catch (ParseException e) {
    // Ignore ...
}

It seems to do what the original codes intention was.

What would be the cleanest way to solve this problem? I seem to be seeing this 
pattern quite a lot and the try/catch solution sounds quite annoying with all 
this try-catch handling.

Chris


Reply via email to