Java Chinese Check isChinaOrEnName(String str)

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

Description

is China Or En Name

License

Open Source License

Declaration

public static boolean isChinaOrEnName(String str) 

Method Source Code

//package com.java2s;

import com.google.common.base.Strings;

public class Main {
    public static final String ENGLISHNAME = "^[a-zA-Z\\s]+\\.?\\s?[a-zA-Z\\s]+$";
    public static final String ALLCHINESE = "^[\u4E00-\u9FA0]+$";

    public static boolean isChinaOrEnName(String str) {
        if (!Strings.isNullOrEmpty(str)) {
            if (str.matches(ENGLISHNAME)) {
                return true;
            }/*w w w . j ava  2 s.co m*/

            if (str.matches(ALLCHINESE)) {
                return true;
            }
        }
        return false;
    }
}

Related

  1. checkCharIsChiness(char c)
  2. isChina(String str)
  3. isChinaLanguage(char[] chars)
  4. isChinaLanguage(String str)
  5. isChineseChar(char c)