java 验证字符串是否包含中文字符

中文的模式:"[\\u4e00-\\u9fa5]|\\\\u"

例子:

private static final Pattern p = Pattern.compile("[\\u4e00-\\u9fa5]|\\\\u");

Matcher m = p.matcher(str);

if(m.find()){

System.out.println("found!");

}

猜你喜欢

转载自www.cnblogs.com/lzmrex/p/9209091.html
今日推荐