包装类-Character
1,isDigit();是否是数字
char c = '1';
boolean bool = Character.isDigit(c);
System.out.println(bool);//true
2,isLetter();是否是字母
char c2 = 'a';
boolean bool2 = Character.isLetter(c2);
System.out.println(bool2);//true
3,isLetterOrDigit();是否是字母或数字
char c3 = '3';
boolean bool3 = Character.isLetterOrDigit(c3);
System.out.println(bool3);
4,isLowerCase();是否是小写
char c4 = 'c';
boolean bool4 = Character.isLowerCase(c4);
System.out.println(bool4);
5,isUpperCase();是否是大写
char c5 = 'W';
boolean bool5 = Character.isUpperCase(c5);
System.out.println(bool5);
6,toLowerCase();转换为小写
char c6 = 'T';
System.out.println(Character.toLowerCase(c6));//t
7,toUpperCase();转换为大写
char c7 = 'n';
System.out.println(Character.toUpperCase(c7));//N
8,isSpaceChar();//是否为空格
char c8 = ' ';
System.out.println(Character.isSpaceChar(c8));//true
9,getChars(srcStart,srcEnd,dest,destStart);获取字符数组
String str = "I am a student";
char[] c9 = new char[10];
str.getChars(0, 5, c9, 3);
for(char x : c9){
System.out.print(x + " ");//
}
System.out.println();
10,charAt(index);取单一字符
char c10 = str.charAt(0);
System.out.println(c10);//I