Dim i, nPos, zInvaildList
'預設所要檢查的字串不包含不合法的字元
ChkChar = True
'指定那些字元是不合法的字元
zList = "&'/""<>" '指定"要再前置"
'去掉前後空白,避免傳入NULL
strChk = trim(strChk & "")
zErr = ""
For i = 1 to Len(zList)
nPos = InStr(strChk, Mid(zList, i, 1))
if nPos <> 0 then zErr = zErr & " " & Mid(zList, i, 1)
next
if zErr<> "" then
zMsg = "『" & strChk & "』字串中含有不合法字元:" & zMsg
ChkChar = False
end if
End Function
沒有留言:
張貼留言