怎样把字符串0.30f,0.70f 以逗号split开,然后存入float[]数组
怎样把字符串0.30f,0.70f 以逗号split开,然后存入float[]数组
------解决方案--------------------public class Test{
public static void main(String args[]){
String str= "0.30f,0.70f ";
String[] s = str.split( "\\, ");
float f[] = new float[s.length];
for(int i=0;i <s.length;i++){
f[i] = Float.parseFloat(s[i]);
System.out.println(f[i]);
}
}
}