一.String
1.String转Integer
String s = "666";
int i = Integer.valueOf(s); //注意:Integer.getInteger是将系统属性转为Integer;Integer.getInteger("12345") 应该是得到 null(假设没有名为12345的系统属性)
2.String转Character[]
String s = "666";
char[] cha = s.toCharArray();
3.String分割并转为int[]
String s = "6,6,6";
String[] ss = s.split(",");
int[] i = new int[ss.length];
for (int j = 0; j < ss.length; j++) {
i[j] = Integer.valueOf(ss[j]);
}
二.Character
1.Character转String
char cha = '7';
String s = Character.toString(cha);
2.Character转Integer
char cha = '6';
int i = Character.getNumericValue(cha);
二.Integer
1.Integer转String
int i = 6;
String s = String.valueOf(i);