Convert String to double in Java

后端 未结 14 1468
傲寒
傲寒 2020-11-22 05:52

How can I convert a String such as \"12.34\" to a double in Java?

14条回答
  •  隐瞒了意图╮
    2020-11-22 06:39

    There is another way too.

    Double temp = Double.valueOf(str);
    number = temp.doubleValue();
    

    Double is a class and "temp" is a variable. "number" is the final number you are looking for.

提交回复
热议问题