public static String replaceBlank(String str){
String dest="";
if(str != null){
Pattern p = Pattern.compile("\\s*|\t|\r|\n");
Matcher m = p.matcher(str);
dest = m.replaceAll("");
}
return dest;
}
注:
\n 回车 (\u000a)
\t 水平制表符 (\u0009)
\\s 空格 (\u0008)
\r 换行 (\000d)
String dest="";
if(str != null){
Pattern p = Pattern.compile("\\s*|\t|\r|\n");
Matcher m = p.matcher(str);
dest = m.replaceAll("");
}
return dest;
}
注:
\n 回车 (\u000a)
\t 水平制表符 (\u0009)
\\s 空格 (\u0008)
\r 换行 (\000d)