码迷,mamicode.com
首页 > 其他好文 > 详细

codeTest16

时间:2015-08-03 18:49:30      阅读:107      评论:0      收藏:0      [点我收藏+]

标签:

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");
    }

codeTest16

标签:

原文地址:http://www.cnblogs.com/klguang/p/4699841.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!