修改
This commit is contained in:
@@ -2,15 +2,11 @@ package com.yaoyuan.jiscuss.util;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @author yaoyuan2.chu
|
* @author yaoyuan2.chu
|
||||||
* @Title:
|
* @Title: 去除内容页代码里的HTML标签
|
||||||
* @Package com.yaoyuan.jiscuss.util
|
* @Package com.yaoyuan.jiscuss.util
|
||||||
* @Description:
|
* @Description:
|
||||||
* @date 2020/8/31 20:52
|
* @date 2020/8/31 20:52
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* 去除内容页代码里的HTML标签
|
|
||||||
*/
|
|
||||||
public class DelTagsUtil {
|
public class DelTagsUtil {
|
||||||
/**
|
/**
|
||||||
* 去除html代码中含有的标签
|
* 去除html代码中含有的标签
|
||||||
@@ -54,8 +50,7 @@ public class DelTagsUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
String htmlStr = "<script type>var i=1; alert(i)</script><style> .font1{font-size:12px}</style><span>少年中国说。</span>红日初升,其道大光。<h3>河出伏流,一泻汪洋。</h3>潜龙腾渊, 鳞爪飞扬。乳 虎啸 谷,百兽震惶。鹰隼试翼,风尘吸张。奇花初胎,矞矞皇皇。干将发硎,有作其芒。天戴其苍,地履其黄。纵有千古,横有" +
|
String htmlStr = "test";
|
||||||
"八荒。<a href=\"www.baidu.com\">前途似海,来日方长</a>。<h1>美哉我少年中国,与天不老!</h1><p>壮哉我中国少年,与国无疆!</p>";
|
|
||||||
System.out.println(getTextFromHtml(htmlStr));
|
System.out.println(getTextFromHtml(htmlStr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user