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 运行js

Delphi richedit控件中插入图片bmp(bmp,文件),gif(文件)

Delphi android device information

Delphi 获取邮箱中的用户名

Delphi 将listview保存为txt

Delphi 从paintbox拷贝一部分内容到tbitmap

Delphi datasnap使用ipv6

Delphi编写提取exe文件的ico图标

Delphi 获取 access 数据库所有表

Delphi读取xml文件

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



打赏

取消

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

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

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

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

评论

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