首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

String数组的变换

2012-10-27 
String数组的转换public class toString {? public static void main(String[] args) {??? String string

String数组的转换

public class toString {
? public static void main(String[] args) {
??? String string="2,3,45,6,7,2";
??? String [] strs=string.split(",");
??? if (strs!=null&&strs.length>0) {
???? int []intArr=new int[strs.length];
???? for (int i = 0; i < strs.length; i++) {
????? intArr[i]=Integer.valueOf(strs[i]);
????? System.out.println(intArr[i]);
???? }
??? }
?? }
}

热点排行