public static String getStringNoBlank(String str) {
if(str!=null && !"".equals(str)) {
Pattern p = Pattern.compile("\\s*|\t|\r|\n");
Matcher m = p.matcher(str);
String strNoBlank = m.replaceAll("");
return strNoBlank;
}else {
return str;
}
}
转载于:https://www.cnblogs.com/tanglong8848/archive/2012/02/15/3010736.html