asp 过滤html代码函数

Function FilterHTML(str)
    Dim re,cutStr
    Set re=new RegExp
    re.IgnoreCase =True
    re.Global=True
    re.Pattern="<(.[^>]*)>"
    str=re.Replace(str,"")   
    set re=Nothing

    str=Replace(str,"&nbsp","")
    str=Replace(str,chr(10),"")
    str=Replace(str,chr(13),"")
    str=Replace(str," ","")
    str=Replace(str," ","")

    Dim l,t,c,i
    l=Len(str)
    t=0
    For i=1 to l
        c=Abs(Asc(Mid(str,i,1)))
        If c>255 Then
            t=t+2
        Else
            t=t+1
        End If
        cutStr=str
    Next
   
    FilterHTML= cutStr
End Function
原文地址:https://www.cnblogs.com/bestsaler/p/1835482.html