添加特殊字符串函数

2006-02-08 17:21:30

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,"'","&#39;")'单引号 strText = Replace(strText,"""",""")'双引号 strText = Replace(strText,Chr(9)," ")'空格 strText = Replace(strText, Chr(10) & Chr(10), " ") strText = Replace(strText,Chr(10)," ")'回车 strText = Replace(strText,Chr(13),"")'回车 strText = Replace(strText,Chr(32)," ")'空格 strText = Replace(strText,Chr(34),""")'双引号 strText = Replace(strText,Chr(39),"&#39;")'单引号 strText = Replace(strText,"script","script")'script strText = Replace(strText,"(","(") '左( strText = Replace(strText,")",")") '右) strText = Replace(strText,"--","--")'SQL注释符 FormatStr = strText End Function