@Test public void testhtml() { String html = "<div class=\"ipaddress\">服务器IP地址：</div>"; System.out.println(WebUtil.unhtml(html)); assertEquals(html, WebUtil.html(WebUtil.unhtml(html))); }
public static String html(String content) { if (StringUtil.isEmpty(content)) { return ""; } String html = content; html = html.replaceAll("&apos;", "'"); html = html.replaceAll("&quot;", "\""); html = html.replaceAll("&nbsp;", " "); html = html.replaceAll("&lt;", "<"); html = html.replaceAll("&gt;", ">"); return html; }
WebUtil { public static String html(String content) { if (StringUtil.isEmpty(content)) { return ""; } String html = content; html = html.replaceAll("&apos;", "'"); html = html.replaceAll("&quot;", "\""); html = html.replaceAll("&nbsp;", " "); html = html.replaceAll("&lt;", "<"); html = html.replaceAll("&gt;", ">"); return html; } }
WebUtil { public static String html(String content) { if (StringUtil.isEmpty(content)) { return ""; } String html = content; html = html.replaceAll("&apos;", "'"); html = html.replaceAll("&quot;", "\""); html = html.replaceAll("&nbsp;", " "); html = html.replaceAll("&lt;", "<"); html = html.replaceAll("&gt;", ">"); return html; }  }
WebUtil { public static String html(String content) { if (StringUtil.isEmpty(content)) { return ""; } String html = content; html = html.replaceAll("&apos;", "'"); html = html.replaceAll("&quot;", "\""); html = html.replaceAll("&nbsp;", " "); html = html.replaceAll("&lt;", "<"); html = html.replaceAll("&gt;", ">"); return html; }  static String escape(String str, String encoding); static String unescape(String str, String encoding); static String unhtml(String content); static String html(String content); }
WebUtil { public static String html(String content) { if (StringUtil.isEmpty(content)) { return ""; } String html = content; html = html.replaceAll("&apos;", "'"); html = html.replaceAll("&quot;", "\""); html = html.replaceAll("&nbsp;", " "); html = html.replaceAll("&lt;", "<"); html = html.replaceAll("&gt;", ">"); return html; }  static String escape(String str, String encoding); static String unescape(String str, String encoding); static String unhtml(String content); static String html(String content);  }