Android Chinese String Check isContainChinese(String str)

Here you can find the source of isContainChinese(String str)

Description

is Contain Chinese

Declaration

public static Boolean isContainChinese(String str) 

Method Source Code



public class Main {

    public static Boolean isContainChinese(String str) {
        Boolean isChinese = false;
        String chinese = "[\u0391-\uFFE5]";
        if (!isEmpty(str)) {
            //from w  w  w  .j a va 2s.com
            for (int i = 0; i < str.length(); i++) {
                
                String temp = str.substring(i, i + 1);
                
                if (temp.matches(chinese)) {
                    isChinese = true;
                } else {

                }
            }
        }
        return isChinese;
    }

    public static boolean isEmpty(String str) {
        return str == null || str.trim().length() == 0;
    }
}

Related

  1. isChinese(String str)
  2. isChinese(String strName)
  3. checkStringIsChinese(String str)
  4. isChinese(char c)
  5. isChinese(String str)
  6. hasChinese(String key)