Re: Problem running some examples with non US locales
Ups ... wrong list ... forget this __ Am 14.02.18, 22:06 schrieb "Christofer Dutz": 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? Chris
Problem running some examples with non US locales
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? Chris