String ss = "6月 26日|6月 27日|6月 28日";
System.out.println(ss.replaceAll(" ", ""));
System.out.println(ss.replaceAll(" ", "").replaceAll("\\|", " | "));
小结:java在替换特殊字符的时候 要转义
StringBuffer sb = new StringBuffer(26);//.append("").append("|int,").append(1).append("|int,").append(0).append("|int,").append(10).append("|int");
System.out.println(sb.toString());
System.out.println(new StringBuffer(26).append("").append("|int,").append(1).append("|int,").append(0).append("|int,").append(10).append("|int").toString());
这里 int 在构造中不能直接使用int 在构造这样会不认的 就是不能转化