数字型 、String字符串转换

Java代码 收藏代码 String str = "1,2,3,4,5,6" public int[] StringtoInt(String str) { int ret[] = new int[str.length()]; StringTokenizer toKenizer = new StringTokenizer(str, ","); int i = 0; while (toKenizer.hasMoreElements()) { ret[i++] = Integer.valueOf(toKenizer.nextToken()); } return ret; 方法二、 Java代码 收藏代码 String a = "1,2,3,4,5,6" String str[] = a.split(","); int array[] = new int[str.length]; for(int i=0;i
posted @ 2016-04-08 19:52  dy9776  阅读(171)  评论(0编辑  收藏  举报