标签:
public static boolean isEnglish(String str) {
return str.matches("^[a-zA-Z.,!?]*");
}
public static boolean isChinese(String str) {// 检测是否包含中文
String regEx = "[\\u4E00-\\u9FA5]+";
Pattern p = Pattern.compile(regEx);
Matcher m = p.matcher(str);
if (m.find()) {
return true;
} else {
return false;
}
}
static boolean isNumber(String str)
{
Pattern pattern=Pattern.compile("-?[0-9]*[.]?[0-9]*");
Matcher match=pattern.matcher(str);
if(match.matches()==false)
{
return false;
}
else
{
return true;
}
}
}
----------------------------------------------
提取String中的中,英,数
--------------------
String str1 = str.replaceAll("[^\\u4e00-\\u9fa5]", "");
String str2 = str.replaceAll("[^0-9]", "");
String str3 = str.replaceAll("[^a-zA-Z]", "");
--------------------
标签:
原文地址:http://www.cnblogs.com/jimoqiongyin/p/4793328.html