Convert string to float?

后端 未结 6 1021
谎友^
谎友^ 2020-12-09 07:49

Just as title says. I don\'t believe it is possible to do this but if it is let me know.

This is needed for a bukkit (minecraft server) plugin I\'m writing. I want

6条回答
  •  我在风中等你
    2020-12-09 08:29

    Try this:

    String yourVal = "20.5";
    float a = (Float.valueOf(yourVal)).floatValue(); 
    System.out.println(a);
    

提交回复
热议问题