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 随便找个网站获取格林威治时间, 并转换到北京时间

Delphi webbrowser 无法调用当前浏览器的版本

Delphi 在xp/2k 下实现 win+ctrl+del 等键的屏蔽的方法

Delphi编程禁止用户关闭操作系统

Delphi 字符串替换函数[单元文件 sysutils]

Delphi高亮显示trichedit当前行

Delphi 按字母排序的windows窗口公用消息

Delphi 时间戳与日期互转

Delphi 在datasnap中使用firedac

Delphi 生成xml 方法 与 Delphi txt文件操作

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



打赏

取消

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

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

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

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

评论

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