asp CutStrX字符串截取函數(shù)(過濾全部HTML標(biāo)記)
更新時(shí)間:2011年07月05日 15:30:51 作者:
asp CutStrX字符串截取函數(shù)(過濾全部HTML標(biāo)記),比較不錯,需要的朋友可以參考下。
復(fù)制代碼 代碼如下:
Function CutStrX(ByVal Str,ByVal StrLen)
Dim l,t,c,i,r
'過濾全部HTML標(biāo)記
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
相關(guān)文章
GetBody asp實(shí)現(xiàn)截取字符串的代碼
GetBody asp實(shí)現(xiàn)截取字符串的代碼...2007-09-09

