怎样将文本框中的字符串转化为float型??

解决方案 »

  1.   

    http://www.ccw.com.cn/htm/app/aprog/01_6_11_2.asp
      

  2.   

    public static float parseFloat(String s)
      

  3.   

    java.lang.Float.parseFloat(str);
      

  4.   

    Float.parseFloat(str);
    字符串转换为数字的操作在相应的数字类(Integer,Float,Double等)中均有类似的操作
    例如Integer.parseInt(String);
    不过需要catch 或者throw NumberFormatException。