标签:eal AC 它的 string html 标签 java nbsp pre
public static String stripHtml(String content) {
// <p>段落替换为换行
content = content.replaceAll("<p .*?>", "\r\n");
// <br><br/>替换为换行
content = content.replaceAll("<br\\s*/?>", "\r\n");
// 去掉其它的<>之间的东西
content = content.replaceAll("\\<.*?>", "");
// 还原HTML
// content = HTMLDecoder.decode(content);
return content;
}
标签:eal AC 它的 string html 标签 java nbsp pre
原文地址:https://www.cnblogs.com/firstdream/p/8945357.html