首页 > 其他 > 详细

判断字符串是否包含汉字

时间:2018-03-14 19:29:23      阅读:220      评论:0      收藏:0      [点我收藏+]
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Test2 {

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


public static void main(String[] args) {


boolean x = isContainChinese("s你好ss");
System.out.println(x);


}


public static boolean isContainChinese(String str) {
Matcher m = p.matcher(str);
if (m.find()) {
return true;
}
return false;
}
}

判断字符串是否包含汉字

原文:https://www.cnblogs.com/SEC-fsq/p/8569537.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!