标签:字符串转换 string print sys 数组 ++ ble 3.1 for
//字符串转换成数组。
String string = "a,b,c";
String [] stringArr= string.split(",");
for(int i=0;i<3;i++)
System.out.println(stringArr[i]);
//字符数组转换成int型数组。
char chArray[]={‘1‘,‘2‘,‘3‘};
int []Array=new int[3];
for(int i=0;i<3;i++){
Array[i]=chArray[i]-‘0‘;
System.out.println(Array[i]);}
//z字符串型小数数组转换成实数数组。
String [] a={"2.31","2.34","3.14"};
double[]array=new double[3];
for(int i=0;i<3;i++){
array[i]=Double.parseDouble(a[i]);
System.out.println(array[i]);}
标签:字符串转换 string print sys 数组 ++ ble 3.1 for
原文地址:http://www.cnblogs.com/d1992/p/6790508.html