package com.heima.test;
public class StringTest4 {
/**
* 老师解决的问的:面试的坑
* "afwe黑uj尚东峰景324535¥%¥()"
* 打印大写,小写,数字,符号的个数
*/
public static void main(String[] args) {
String str = "afwe黑uj尚东峰景324535¥%¥()";
for (int i = 0; i < str.length(); i++) {
char c =str.charAt(i);
byte[] arr = (c+"").getBytes();
// System.out.println(arr.length);
if(arr.length==2){
System.out.println(new String(arr));
}
}
}
}
|
|