- <%
- '**************************************************
- '函數(shù)名:gotTopic
- '作 用:截字符串,漢字一個算兩個字符,英文算一個字符
- '參 數(shù):str ----原字符串
- ' strlen ----截取長度
- '返回值:截取后的字符串
- '**************************************************
- function gotTopic(str,strlen)
- if str="" then
- gotTopic=""
- exit function
- end if
- dim l,t,c, i
- str=replace(replace(replace(replace(str," "," "),""",chr(34)),">",">"),"<","<")
- str=replace(str,"?","")
- 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
- gotTopic=left(str,i) & "…"
- exit for
- else
- gotTopic=str
- end if
- next
- gotTopic=replace(replace(replace(replace(gotTopic," "," "),chr(34),"""),">",">"),"<","<")
- end function
- '=========================================================
- '函數(shù):RemoveHTML(strHTML)
- '功能:去除HTML標記
- '參數(shù):strHTML --要去除HTML標記的字符串
- '=========================================================
- Function RemoveHTML(strHTML)
- Dim objRegExp, Match, Matches
- Set objRegExp = New Regexp
- objRegExp.IgnoreCase = True
- objRegExp.Global = True
- '取閉合的<>
- objRegExp.Pattern = "<.+?>"
- '進行匹配
- Set Matches = objRegExp.Execute(strHTML)
- ' 遍歷匹配集合,并替換掉匹配的項目
- For Each Match in Matches
- strHtml=Replace(strHTML,Match.Value,"")
- Next
- RemoveHTML=strHTML
- Set objRegExp = Nothing
- set Matches=nothing
- End Function
- %>
|
新聞熱點
疑難解答
圖片精選