代码如下:
- /** HTML转义 **/
- String s = HtmlUtils.htmlEscape("<div>hello world</div><p> </p>");
- System.out.println(s);
- String s2 = HtmlUtils.htmlUnescape(s);
- System.out.println(s2);
输出的结果如下:
- <div>hello world</div><p>&nbsp;</p>
- <div>hello world</div><p> </p>