ASP一个常用的自定义替换函数

<%
Function myReplace(myString)'
    myString=Replace(myString,"&","&amp;")         '替换&为字符实体&amp;
    myString=Replace(myString,"<","&lt;")          '替换<为字符实体&lt;
    myString=Replace(myString,">","&gt;")          '替换>为字符实体&gt;
    myString=Replace(myString,chr(13),"<br>")      '替换回车符为换行标记<br>  
    myString=Replace(myString,chr(32),"&nbsp;")    '替换空格符为字符实体&nbsp;
    myString=Replace(myString,chr(9),"&nbsp;&nbsp;&nbsp;&nbsp;")     '替换Tab缩进符为
    myString=Replace(myString,chr(39),"&acute;")   '替换单引号为字符实体&acute;
    myString=Replace(myString,chr(34),"&quot;")    '替换双引号为字符实体&quot;
    myReplace=myString                             '返回函数值
End Function
%>

评论: 1 | 引用: 0 | 查看次数: 6663
发表评论
登录后再发表评论!