检查非法字符

来源:互联网 发布:陕西信合网络 编辑:程序博客网 时间:2024/05/01 15:12
  '******************************
 '名称: ChkInvStr
 '参数:Str
 '返回值:True/False
 '创建时间:2005年5月2日
 '作用:检查参数是否有非法字符
 '******************************
 Public Function ChkInvStr(Str)
  Rem 定义需要过滤得非法字符
  Dim InvaildWord,inWords,i
  Str=CStr(Str)
  ChkInvStr=False
  If Len(Replace(p_InvaildWords,Chr(0),""))<1 Then
   AddErrorCode(103) 'invaildwords is null
   Exit Function
  Else
   If Instr(1,p_Invaildwords,"|")>0 Then
    InvaildWord=Split(p_InvaildWords,"|")
    inWords=LCase(Trim(Str))
    For i=LBound(InvaildWord) To UBound(InvaildWord)
     If Instr(inWords,InvaildWord(i))>0 Then
      p_Error=1982
      AddErrorCode(105)
      ChkInvStr=True
      Exit Function
     End If
    Next
   Else
    AddErrorCode(104) '"|" is requried.
    Exit Function
   End If
  End If
 End Function