日期:2014-05-20  浏览次数:20644 次

字符串转换成整数数组问题
现有String s = "1 2 3 4 11 22 33 44";

请问如何将其转换成整数数组?字符串里的数字是用空格分隔的。

------解决方案--------------------
String s = "1 2 3 4 11 22 33 44";
String[] x=s.split(" ");
int[] m=new int[x.length];
for(int i=0;i<x.length;i++){
m[i]=Integer.parseInt(x[i]);
}
这样试试