/**
* 文本输入框做输入内容校验逻辑,必须包含英文或者汉字中的一种的条件,不能为纯数字,纯符号
*/
public static boolean isEnglishorChinese(String str){
Pattern regex = Pattern.compile(".*([\\u4E00-\\u9FA5]|[a-zA-Z])+.*");
return regex.matcher(str).matches();
}
经过检验
/**
* 文本输入框做输入内容校验逻辑,必须包含英文或者汉字中的一种的条件,不能为纯数字,纯符号
*/
public static boolean isEnglishorChinese(String str){
Pattern regex = Pattern.compile(".*([\\u4E00-\\u9FA5]|[a-zA-Z])+.*");
return regex.matcher(str).matches();
}
经过检验