关于Java 去除空格,换行的代码

public static String replaceBlank(String str) {
String dest = "";
if (str != null) {
//Pattern p = Pattern.compile("\\s*|\t|\r|\n|\\x20");
Pattern p = Pattern.compile("\\s*|\t|\r|\n");
Matcher m = p.matcher(str);
dest = m.replaceAll("");
}
return dest;
}
posted @ 2019-03-20 09:48  夏风中的Young_Uncle  阅读(2397)  评论(0)    收藏  举报