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
  • 14,295
  • 27
  • 73
  • 107

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
  • 59,379
  • 22
  • 134
  • 163
0

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

user
  • 6,807
  • 7
  • 41
  • 79
0

i think this example works:

String to Double - Java

CoOkie
  • 84
  • 1
  • 5