(原创)分享自己写的几个工具类(六)判断给定的一串字符串中是否含有最少一个中文字符

判断给定的一串字符串中是否含有最少一个中文字符

代码如下

    public static boolean isHaveChinese(String str) {
        String regEx = "[\\u4e00-\\u9fa5]+";//中文的第一个和最后一个字符编码
        Pattern p = Pattern.compile(regEx);
        Matcher m = p.matcher(str);
        if (m.find())
            return true;
        else
            return false;
    }

猜你喜欢

转载自blog.csdn.net/Android_xiong_st/article/details/87365258