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 tdatetime 日期时间值的比较

Delphi xe android的所有权限按照分类总结说明

Delphi xe8 androdi利用httpclient实现的一个app自动更新组件

Delphi中实现dbgrid列宽度自动调整

Delphi 获取一个文件夹下的所有文件

Delphi winapi: movewindow - 改变窗口的位置与大小

Delphi winapi: getmodulefilename、getmodulehandle

Delphi gmt时间与tdatetime转换

Delphi图片base64编码

Delphi10及以上版本安装activex控件

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



打赏

取消

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

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

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

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

评论

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