刚刚写好的ASP显示HTML代码(转义)函数
2012-1-21 小古
Public Function XmlEncode(strText)
Dim aryChars
aryChars = Array(38, 60, 62, 34, 61, 39)
Dim i
For i = 0 To UBound(aryChars)
strText = Replace(strText, Chr(aryChars(i)), "&#" & aryChars(i) & ";")
Next
strText = Replace(strText, Chr(32), " ")
strText = Replace(strText, Chr(9), " ")
strText = Replace(strText, Chr(10), "<br/>")
strText = Replace(strText, Chr(13), "<br/>")
strText = Replace(strText, chr(13)&chr(10) , "<br/>")
XmlEncode = strText
End Function
评论:
发表评论: