package com.meritit.test;
public class TestChart {
public static void main(String[] args) throws Exception {
String aa = "中国China人";
for (int i = 0; i < aa.length(); i++) {
String bb = aa.substring(i, i + 1);
boolean cc = java.util.regex.Pattern.matches("[\u4E00-\u9FA5]", bb);
if (cc) {
System.out.println(bb);
}
}
}
}
java中判断字符串中是否有中文字符
最新推荐文章于 2025-04-09 10:36:24 发布
本文详细解析了一段使用Java正则表达式匹配中文字符的代码,通过实例展示了如何在Java中利用Pattern匹配中文汉字。
1万+

被折叠的 条评论
为什么被折叠?



