java判断字符串是否包含汉字

Pattern p = Pattern.compile("[\u4e00-\u9fa5]");
Matcher m = p.matcher(passwords);
if (m.find()) {
    //包含
} else {
    //不包含
}
发布了40 篇原创文章 · 获赞 43 · 访问量 15万+

猜你喜欢

转载自blog.csdn.net/qq_37581708/article/details/72368032