Android Chinese String Check hasChinese(String key)

Here you can find the source of hasChinese(String key)

Description

has Chinese

Declaration

public static boolean hasChinese(String key) 

Method Source Code

//package com.java2s;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    public static boolean hasChinese(String key) {
        try {// w  ww  . j a  v  a  2  s  . c  om
            Pattern pattern = Pattern.compile("[\u4e00-\u9fa5]+");
            Matcher matcher = pattern.matcher(key);
            if (matcher.find()) {
                return true;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return false;
    }
}

Related

  1. isChinese(String strName)
  2. checkStringIsChinese(String str)
  3. isChinese(char c)
  4. isChinese(String str)
  5. isContainChinese(String str)