过滤Replace非法字符
如题。
Function formatStr(strText)
On Error Resume Next
strText = Trim(strText)
If strText="" Then
Exit Function
End If
strText = Replace(strText,"<","<") '左<
strText = Replace(strText,">",">") '右>
strText = Replace(strText,";",";") '分号
strText = Replace(strText,"'","'") '单引号
strText = Replace(strText,"""",""") '双引号
strText = Replace(strText,Chr(9)," ") '空格
strText = Replace(strText, Chr(10) & Chr(10), "<BR><BR>")
strText = Replace(strText,Chr(10),"<br/>") '回车
strText = Replace(strText,Chr(13),"") '回车
strText = Replace(strText,Chr(32)," ") '空格
strText = Replace(strText,Chr(34),""") '双引号
strText = Replace(strText,Chr(39),"'") '单引号
strText = Replace(strText,"script","script") 'script
strText = Replace(strText,"(","(") '左(
strText = Replace(strText,")",")") '右)
strText = Replace(strText,"--","--") 'SQL注释符
FormatStr = strText
Function formatStr(strText)
On Error Resume Next
strText = Trim(strText)
If strText="" Then
Exit Function
End If
strText = Replace(strText,"<","<") '左<
strText = Replace(strText,">",">") '右>
strText = Replace(strText,";",";") '分号
strText = Replace(strText,"'","'") '单引号
strText = Replace(strText,"""",""") '双引号
strText = Replace(strText,Chr(9)," ") '空格
strText = Replace(strText, Chr(10) & Chr(10), "<BR><BR>")
strText = Replace(strText,Chr(10),"<br/>") '回车
strText = Replace(strText,Chr(13),"") '回车
strText = Replace(strText,Chr(32)," ") '空格
strText = Replace(strText,Chr(34),""") '双引号
strText = Replace(strText,Chr(39),"'") '单引号
strText = Replace(strText,"script","script") 'script
strText = Replace(strText,"(","(") '左(
strText = Replace(strText,")",")") '右)
strText = Replace(strText,"--","--") 'SQL注释符
FormatStr = strText
