HTML特殊转义字符列表

HTML特殊转义字符列表
最常用的字符实体
Character Entities
显示 说明 实体名称 实体编号
半方大的空白    
全方大的空白    
不断行的空白格    
< 小于 &lt; &#60;
> 大于 &gt; &#62;
& &符号 &amp; &#38;
" 双引号 &quot; &#34;
? 版权 &copy; &#169;
? 已注册商标 &reg; &#174;
? 商标(美国) ? &#8482;
× 乘号 &times; &#215;
÷ 除号 &divide; &#247;



/// <summary>
/// Replaces the &lt; with the less then symbol and &gt; with the greater then symbol.
/// </summary>
/// <param name="xml">String to be unescaped</param>
/// <returns>An xml string containing the greter then and less then symbols.</returns>
private string UnEscapeXml(string xml)
{
string result = xml.Replace("&lt;", "<");
result = result.Replace("&gt;", ">");
result = result.Replace("'<'", "&lt;");
result = result.Replace("'quot'", "&quot;");
return result.Replace("'>'", "&gt;");
}

/// <summary>
/// Replaces the less then and greater then symbol with &lt; and &gt;
/// </summary>
/// <param name="xml">String to be escaped</param>
/// <returns>An xml string with &lt; and &gt;</returns>
private string EscapeXml(string xml)
{
string result = xml.Replace("&lt;", "'&lt;'");
result = result.Replace("&quot;", "'quot'");
result = result.Replace("&gt;", "'&gt;'");
result = result.Replace("<", "&lt;");
return result.Replace(">", "&gt;");
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值