标签:
public String trim(String s) throws IOException { String text = s.replaceAll("<.*?>", "").replaceAll(" ", ""); StringBuffer sb = new StringBuffer(); StringReader sr = new StringReader(text); BufferedReader br = new BufferedReader(sr); String temp = ""; while ((temp = br.readLine()) != null) { temp = temp.trim(); temp = temp + "\r\n"; sb.append(temp); } return sb.toString().trim().replaceAll("\r\n\r\n", "\r\n"); }
标签:
原文地址:http://www.cnblogs.com/klguang/p/4699666.html