Android Utililty Methods Chinese String Check

List of utility methods to do Chinese String Check

Description

The list of methods to do Chinese String Check are organized into topic(s).

Method

booleanisChinese(String str)
is Chinese
Pattern pattern = Pattern.compile("[\u0391-\uFFE5]+$");
return pattern.matcher(str).matches();
booleanisChinese(String strName)
is Chinese
char[] ch = strName.toCharArray();
for (int i = 0; i < ch.length; i++) {
    char c = ch[i];
    if (isChinese(c)) {
        return true;
return false;
...
booleancheckStringIsChinese(String str)
check String Is Chinese
if (null == str) {
    return false;
Pattern pattern = Pattern.compile("[\\u4E00-\\u9FA5]+");
Matcher matcher = pattern.matcher(str);
return matcher.matches();
booleanisChinese(char c)
is Chinese
Character.UnicodeBlock ub = Character.UnicodeBlock.of(c);
if (ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS
        || ub == Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS
        || ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A
        || ub == Character.UnicodeBlock.GENERAL_PUNCTUATION
        || ub == Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION
        || ub == Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS) {
    return true;
...
BooleanisChinese(String str)
is Chinese
Boolean isChinese = true;
String chinese = "[\u0391-\uFFE5]";
if (!isEmpty(str)) {
    for (int i = 0; i < str.length(); i++) {
        String temp = str.substring(i, i + 1);
        if (temp.matches(chinese)) {
        } else {
            isChinese = false;
...
BooleanisContainChinese(String str)
is Contain Chinese
Boolean isChinese = false;
String chinese = "[\u0391-\uFFE5]";
if (!isEmpty(str)) {
    for (int i = 0; i < str.length(); i++) {
        String temp = str.substring(i, i + 1);
        if (temp.matches(chinese)) {
            isChinese = true;
        } else {
...
booleanhasChinese(String key)
has Chinese
try {
    Pattern pattern = Pattern.compile("[\u4e00-\u9fa5]+");
    Matcher matcher = pattern.matcher(key);
    if (matcher.find()) {
        return true;
} catch (Exception e) {
    e.printStackTrace();
...