MCPcopy Create free account
hub / github.com/0opslab/opslabJutil / unhtml

Method unhtml

src/main/java/com/opslab/helper/WebHelper.java:65–76  ·  view source on GitHub ↗

HTML标签转义方法 空格 &nbsp; < 小于号 &lt; > 大于号 &gt; & 和号 &amp; " 引号 &quot; ' 撇号 &apos; ¢ 分 &cent; £ 镑 &pound; ¥ 日圆 &yen; € 欧元 &euro; § 小节 &sect; © 版权 &copy; ® 注册商标 &reg; ™ 商标 &trade; × 乘号 &times; ÷ 除号 &divide;

(String content)

Source from the content-addressed store, hash-verified

63 * ÷ 除号 &divide;
64 */
65 public static String unhtml(String content) {
66 if (StringUtil.isEmpty(content)) {
67 return "";
68 }
69 String html = content;
70 html = html.replaceAll("'", "&apos;");
71 html = html.replaceAll("\"", "&quot;");
72 html = html.replaceAll("\t", "&nbsp;&nbsp;");
73 html = html.replaceAll("<", "&lt;");
74 html = html.replaceAll(">", "&gt;");
75 return html;
76 }
77
78 /**
79 * html转实体

Callers 1

testhtmlMethod · 0.95

Calls 1

isEmptyMethod · 0.95

Tested by 1

testhtmlMethod · 0.76