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"); }
时间: 2024-10-05 19:45:05