1 public static void main(String[] args) { 2 String aa="eng汉字,,.123ds"; 3 char[] charArray = aa.toCharArray(); 4 for (char c : charArray) { 5 String cnorEn = isCnorEn(c); 6 System.out.println(c+":"+cnorEn); 7 } 8 } 9 static String isCnorEn(char c){ 10 if(c >= 0x0391 && c <= 0xFFE5) //中文字符 11 return "中文"; 12 if(c>=0x0000 && c<=0x00FF){ //英文字符 13 return "eng"; 14 } 15 return "else"; 16 }
https://www.cnblogs.com/go4mi/p/6032504.html