在Java中将字符串转换为Double如何转换String比如"12.34"转到double在爪哇?
3 回答
FFIVE
TA贡献1797条经验 获得超6个赞
Double.parseDouble()
String
double
:
String text = "12.34"; // example Stringdouble value = Double.parseDouble(text);
double total = Double.parseDouble(jlbTotal.getText()); double price = Double.parseDouble(jlbPrice.getText());
有只小跳蛙
TA贡献1824条经验 获得超8个赞
String number = "123,321";double value = Double.parseDouble( number.replace(",",".") );
不负相思意
TA贡献1777条经验 获得超10个赞
String s = "10.1";Double d = Double.parseDouble(s);
添加回答
举报
0/150
提交
取消