asp 过滤非法字符函数

时间:2022-04-15 02:26:45
  1. <%  
  2. Function cutbadchar(str)  
  3. badstr="不|文|明|字|符|列|表|格|式"  
  4. badword=split(badstr,"|")  
  5. For i=0 to Ubound(badword)  
  6. If instr(str,badword(i)) > 0 then  
  7. str=Replace(str,badword(i),"***")  
  8. End If  
  9. Next  
  10. cutbadchar=str  
  11. End Function  
  12. Response.Write cutbadchar("中国不阿斗发射点发明")  
  13. %>