public static void main(String[] args) {
System.out.println(isContainEnglish("This is a piece of English"));
}
/**
*
* @param str
* @return true:是字母,false:含有非法字符
*/
public static boolean isContainEnglish(String str) {
Pattern p = Pattern.compile("^[ A-Za-z]+$");
Matcher m = p.matcher(str);
if (m.find()) {
return true;
}
return false;
}