注册 登录
编程论坛 ASP技术论坛

asp中过滤脏字的问题

renxiaoyi 发布于 2011-06-15 17:10, 499 次点击
我做了一个留言的功能,怎么能过滤脏字呢?有木有好方法?
4 回复
#2
孤独冷雨2011-06-15 19:26
把你要替换的字列出来,然后循环用replace作替换成*号!
#3
ywyql_842011-06-16 11:03
可以做个判断如:
Flot="垃圾 | 很垃圾"
Function ChkWord(str)
cout = Split(ain," | ")
ChkWord = true
On Error Resume Next
For i=0 To Ubound(cout)
   If Instr(lcase(Str),cout(i)) <> 0 Then
    ChkWord = False
    Exit Function
   End If
Next
End Function
If Not ChkWord(Flot) Then Response.Write "您提交的留言含有非法字符"
#4
chenxingg2011-06-17 09:38
能写正则就好了
#5
r1314152011-06-17 15:19
继续~~
1