java - Best way to parseDouble with comma as decimal separator? -
following resulting in exception
:
string p="1,234"; double d=double.valueof(p); system.out.println(d);
is there better way parse "1,234"
1.234
than: p = p.replaceall(",",".");
?
numberformat format = numberformat.getinstance(locale.france); number number = format.parse("1,234"); double d = number.doublevalue();
Comments
Post a Comment