Java去掉空格换行符回车的方法
程序员文章站
2022-05-26 11:29:14
...
public static String replace(String str) {
String destination = "";
if (str!=null) {
Pattern p = Pattern.compile("\\s*|\t|\r|\n");
Matcher m = p.matcher(str);
destination = m.replaceAll("");
}
return destination;
}
原文:https://blog.csdn.net/qq_33537022/article/details/82887761