public static void main(String[] args) {
String str = "Welcome to 北京";
for (int i = 0; i < str.length(); i++) {
String result = str.substring(i, i + 1);
boolean flag = Pattern.matches("[\u4E00-\u9FA5]", result);
if (flag) {
System.out.println(result);
}
}
}
String str = "Welcome to 北京";
for (int i = 0; i < str.length(); i++) {
String result = str.substring(i, i + 1);
boolean flag = Pattern.matches("[\u4E00-\u9FA5]", result);
if (flag) {
System.out.println(result);
}
}
}