is Chinese char - Java Internationalization

Java examples for Internationalization:Chinese

Description

is Chinese char

Demo Code

public class Main {


  public static boolean is_chinese_char(String str) {
    char c;/*from  www  .  ja  va 2  s.  com*/
    if (isNull(str))
      return false;
    for (int i = 0; i < str.length(); i++) {
      c = str.charAt(i);
      if (!((c <= '9' && c >= '0') || (c <= 'z' && c >= 'a') || (c <= 'Z' && c >= 'A') || c == '_')
          || (c >= '\u4E00' && c <= '\u9FA5')) {
        return false;
      }
    }
    return true;
  }

  public static boolean isNull(String str) {
    if (str == null || str.length() == 0) {
      return true;
    }
    return false;
  }
}

Related Tutorials