codeTest16

public String trim(String s) throws IOException {
String text = s.replaceAll("<.*?>", "").replaceAll("&nbsp;", "");
        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

codeTest16的相关文章