软件教程

asp过滤非法字符函数简单易用

来源: 本站    类别: 软件教程    日期: 2015/12/7

 

经常在一些网站上看到这样的功能,当输入一些不文明的词的时候,这些词都会被换成*号去了。下面是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("中国不发射点发明") 
%>

相关文章


Copyright © 2004 - 2024 CNHWW Inc. All Rights Reserved
石家庄市征红网络科技有限公司版权所有 邮政编码:050051
服务电话:0311-85315152 13931185013 在线客服QQ:81447932 / 81447933 邮箱: cnhww@163.com