Thuy
0
Q:

java string to double

public class stringtodouble {
	public static void main(String args) {
    	String string = "1.23";
      	double decimal = Double.parseDouble(string);
    }
}
4
try {
  a = Double.parseDouble(b);
} catch (NumberFormatException e) {
  //the parseDouble failed and you need to handle it here
}
2
Double d = Double.valueOf(String str);
10
Double myDouble = Double.parseDouble("23.5");
1
String s = "10.1";
Double d = Double.parseDouble(s);
1
String number = "123,321";
double value = Double.parseDouble( number.replace(",",".") );
0

New to Communities?

Join the community