Java判断是否是汉字、中文、英文字母和数字

##判断字符串是否是汉字java

public boolean isChinese(String con) {

	for (int i = 0; i < con.length(); i = i + 1) {
		if (!Pattern.compile("[\u4e00-\u9fa5]").matcher(
				String.valueOf(con.charAt(i))).find()) {
			return false;
		}
	}

	return true;
}

##判断是否是中文或英文字母this

private boolean conValidate(String con) {
	if (null != con && !"".equals(con)) {
		if ((this.isChinese(con) || con.matches("^[A-Za-z]+$"))
				&& con.length() <= 10) {
			return true;
		}
	}
	return false;
}

##判断字符串是否是数字code

public boolean isNumeric(String str)
{
    Pattern pattern = Pattern.compile("[0-9]*");
    Matcher isNum = pattern.matcher(str);
    if( !isNum.matches() )
    {
	return false;
    }
    return true;
}
相关文章
相关标签/搜索