zoukankan      html  css  js  c++  java
  • java html实体转义

        public static void main(String[] args) {
    
            String str = " -<->-&-"-'";
    
            String unescapeHtml4 = StringEscapeUtils.unescapeHtml4(str);
            System.out.println(unescapeHtml4);
            String escapeHtml4 = StringEscapeUtils.escapeHtml4(unescapeHtml4);
            System.out.println(escapeHtml4);
    
            String unescapeHtml3 = StringEscapeUtils.unescapeHtml3(str);
            System.out.println(unescapeHtml3);
            String escapeHtml3 = StringEscapeUtils.escapeHtml3(unescapeHtml3);
            System.out.println(escapeHtml3);
    
    
        }

    http://www.w3chtml.com/html/character.html

    最常用的字符实体

    显示结果描述实体名称实体编号
      空格    
    < 小于号 &lt; &#60;
    > 大于号 &gt; &#62;
    & 和号 &amp; &#38;
    " 引号 &quot; &#34;
    ' 撇号 &apos; (IE不支持) &#39;

    其他一些常用的字符实体

    显示结果描述实体名称实体编号
    &cent; &#162;
    £ &pound; &#163;
    ¥ 日圆 &yen; &#165;
    § &sect; &#167;
    © 版权 &copy; &#169;
    ® 注册商标 &reg; &#174;
    × 乘号 &times; &#215;
    ÷ 除号 &divide; &#247;
  • 相关阅读:
    day08作业
    Python进制之间的转换
    day07作业
    Python之深浅拷贝详解
    day06作业
    Python流程控制-循环语句for、while
    Python条件语句-if
    Python变量类型之可变/不可变类型
    Cross platform
    Windows version PE System Key
  • 原文地址:https://www.cnblogs.com/ooo0/p/11975100.html
Copyright © 2011-2022 走看看