0

Possible Duplicate:
Convert a String to Number - Java

String s="1,000.0";

how can I get double value from this String?

thanks for help :)

Community
  • 1
  • 1
Koerr
  • 15,215
  • 28
  • 78
  • 108

3 Answers3

1
    NumberFormat formatter = NumberFormat.getInstance(new Locale("en_US"));

    try {
        System.out.println(formatter.parse("1,000.0"));
    } catch (ParseException e) {
        // Handle this
    }
adarshr
  • 61,315
  • 23
  • 138
  • 167
0

Another option is DecimalFormat.parse(String, ParsePosition).

user
  • 6,897
  • 8
  • 43
  • 79
0

i think this example works:

String to Double - Java

CoOkie
  • 84
  • 1
  • 5