Android Chinese String Check isChinese(char c)

Here you can find the source of isChinese(char c)

Description

is Chinese

Declaration

private static boolean isChinese(char c) 

Method Source Code

//package com.java2s;

public class Main {
    private static boolean isChinese(char c) {
        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;
        }//from w w w  . ja v  a 2 s.c  om
        return false;
    }

    public static boolean isChinese(String strName) {
        char[] ch = strName.toCharArray();
        for (int i = 0; i < ch.length; i++) {
            char c = ch[i];
            if (isChinese(c)) {
                return true;
            }
        }
        return false;
    }
}

Related

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