public class IsContainChinese {

  public static boolean isContainChinese (String str){

    boolean flag=true;

    int count = 0;

    String regEx = "[\\u4e00-\\u9fa5]";

    Pattern p = Pattern.compile(regEx);

    Matcher m = p.matcher(str);

    while (m.find()) {

      for (int i = 0; i <= m.groupCount(); i++) {

        count++;

      }

    }

    if(count==0){

      flag=false;

    }

    return flag;

  }

  public static void main(String[] args) {

    System.out.println(isContainChinese("我是lzhl"));

  }

}

相关文章:

  • 2022-12-23
  • 2021-11-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-31
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-07
  • 2021-10-31
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案