Delphi HTML转义


本文整理自网络,侵删。

 
function torehtml(const strHTML: string): string;
begin
  Result :=strHTML;
  Result := StringReplace(Result, '"', '"',  [rfReplaceAll]);
  Result := StringReplace(Result, '''', ''', [rfReplaceAll]);
  Result := StringReplace(Result, '>',   '>',  [rfReplaceAll]);
  Result := StringReplace(Result, '<',   '&lt;',  [rfReplaceAll]);
  Result := StringReplace(Result, '&',  '&amp;',  [rfReplaceAll]);
end;

常用HTML转义对照表
字符十进制转义字符
"""
&&&
<<<
>>>
不断开空格(non-breaking space)  

相关阅读 >>

Delphi idhttp中设置非标准头信息和读写cookie

python4Delphi 示例应用程序在 Delphi 应用程序中运行简单的 python 脚本

Delphi ile dataset to xml

Delphi 2009 之 tcategorypanelgroup[4]: height

Delphi datasnap中间件如何控制长连接的客户端连接?

Delphi xe android 调试错误:connection closed gracefully

Delphi中获取当前用户sid

Delphi 手机号码库段号地区查询

Delphi fmx 获取控件句柄

Delphi 如何从url提取文件名?

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...