推荐下天枫常用ASP函数封装,推荐大家使用(2)


            Dim Rep,lens,i
            Set rep=new regexp
            rep.Global=true
            rep.IgnoreCase=true
            rep.Pattern="[\u4E00-\u9FA5\uF900-\uFA2D]"
            For each i in rep.Execute(str)
                lens=lens+1
            Next
            Set Rep=Nothing
            lens=lens + len(str)
            strLength=lens
        End Function

    '****************************************************
    '函数名:CutStr
    '作  用:字符串长度切割,超过显示省略号
    '参  数:str    ----字符串内容
    '       strlen ------要显示的长度
    '返回值:切割后字符串内容
    '****************************************************
    Public Function CutStr(str,strlen)
           Dim l,t,i,c
           If str="" Then
              cutstr=""
              Exit Function
           End If
           str=Replace(Replace(Replace(Replace(Replace(str," "," "),""",Chr(34)),">",">"),"<","<"),"|","|")
           l=Len(str)
           t=0
           For i=1 To l
              c=Abs(Asc(Mid(str,i,1)))
              If c>255 Then
                t=t+2

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/2629.html