复制代码代码如下:
Function CutStrX(ByVal Str,ByVal StrLen)
Dim l,t,c,i,r
'过滤全部HTML标记
Set r=New RegExp
r.Global=True
r.MultiLine=True
r.Pattern="(</?[A-Za-z][A-Za-z0-9]*[^>]*>)"
str=r.Replace(str," ")
Set r=Nothing
l=Len(str)
t=0
For i=1 To l
c=AscW(Mid(str,i,1))
If c<0 Or c>255 Then t=t+2 Else t=t+1
IF t>=StrLen Then
CutStrX=Left(Str,i)&"..."
Exit For
Else
CutStrX=Str
End If
Next
End Function