
经常在一些网站上看到这样的功能,当输入一些不文明的词的时候,这些词都会被换成*号去了。下面是asp这样方法的函数。
<%
Function cutbadchar(str)
badstr="不|文|明|字|符|列|表|格|式"
badword=split(badstr,"|")
For i=0 to Ubound(badword)
If instr(str,badword(i)) > 0 then
str=Replace(str,badword(i),"***")
End If
Next
cutbadchar=str
End Function
Response.Write cutbadchar("中国不发射点发明")
%>