//判断表示是否全为英文 private boolean strIsEnglish(String word) { boolean sign = true; // 初始化标志为为'true' for (int i = 0; i < word.length(); i++) { if (!(word.charAt(i) >= 'A' && word.charAt(i) <= 'Z') && !(word.charAt(i) >= 'a' && word.charAt(i) <= 'z')) { return false; } } return true; }
//正则 String str ="abssdf"; str.matches("^[a-zA-Z]*");