What is the easiest and correct way to convert a String number with commas (for example: 835,111.2) to a Double instance.
Thanks.
The easiest is not always the most correct. Here's the easiest:
String s = "835,111.2";
// NumberFormatException possible.
Double d = Double.parseDouble(s.replaceAll(",",""));
I haven't bothered with locales since you specifically stated you wanted commas replaced so I'm assuming you've already established yourself as a locale with comma is the thousands separator and the period is the decimal separator. There are better answers here if you want correct (in terms of internationalization) behavior.