Android Chinese String Check isChinese(String str)

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

Description

is Chinese

Declaration

public static Boolean isChinese(String str) 

Method Source Code



public class Main {

    public static Boolean isChinese(String str) {
        Boolean isChinese = true;
        String chinese = "[\u0391-\uFFE5]";
        if (!isEmpty(str)) {
            //from   w w  w. j  a v  a2  s.  co m
            for (int i = 0; i < str.length(); i++) {
                
                String temp = str.substring(i, i + 1);
                
                if (temp.matches(chinese)) {
                } else {
                    isChinese = false;
                }
            }
        }
        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. isContainChinese(String str)
  6. hasChinese(String key)