/**
- Title: DelHtml.java
- Copyright: Copyright © 2018
- Company:
- author: Lyf
- date: 2019年01月02日
- Description: 字符串html标签替换工具类
*/
字符串标签替换工具类
public Class DelHtmlTag{
public static void main(String[] args) {
String result = delHtmlTag("<a><p>啊哈哈 </p></a>");
System.out.println(result);
}
//删除字符串中的html标签
public static String delHtmlTag(String str){
String newstr = "";
newstr = str.replaceAll("<[.[^>]]*>","");
newstr = newstr.replaceAll(" ", "");
return newstr;
}
}