- ·上一篇文章:asp加密解密函数decrypt
- ·下一篇文章:asp域名查询代码
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 
 
%>
 
<
% 
 
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 
 
%>
asp过滤不文明字符的函数