去掉数据中html语言的函数

来源:互联网 发布:编程makeblock小车 编辑:程序博客网 时间:2024/05/17 23:59
  Function FilterHTML(str,strlen)
    Dim re
    Set re=new RegExp
    re.IgnoreCase =True
    re.Global=True
    re.Pattern="<(.[^>]*)>"
    str=re.Replace(str,"")   
    set re=Nothing
    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
        If t>=strlen Then
            cutStr=left(str,i)&"..."
            Exit For
        Else
            cutStr=str
        End If
    Next
    cutStr=Replace(cutStr,chr(10),"")
    cutStr=Replace(cutStr,chr(13),"")
    FilterHTML=cutStr
End Function 
原创粉丝点击