private String replaceBlank(String s) { String result= null; if (s == null) { return result; } else { Pattern p = Pattern.compile("\s*| | | "); Matcher m = p.matcher(s); result= m.replaceAll(""); return result; }
}
去除字符串中所有的空白字符,包括空格、制表符、回车符等
校验字符串是否只包含英文字母
str.matches("^[a-zA-Z]*")
只包含字母,返回true
含有除字母外其他字符,返回false