zjh
2024-05-14 3ef44331e3bd3e8b61513c88b7439631f49f05c7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package com.ltkj.tduck.utils;
 
import cn.hutool.http.HtmlUtil;
import lombok.experimental.UtilityClass;
 
@UtilityClass
public class HtmlUtils extends HtmlUtil {
 
 
    /**
     * 清除标签 还原转义文本
     * @param content
     * @return
     */
    public static String cleanHtmlTag(String content) {
        // 清除HTML标签和空格 html编码解码
        return HtmlUtil.unescape(content).replaceAll("(<[^<]*?>)|(<[\\s]*?/[^<]*?>)|(<[^<]*?/[\\s]*?>)", "").replaceAll(NBSP, "");
    }
 
}