国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > regex > 正文

截字符串 去除HTML標記

2020-01-20 22:31:11
字體:
來源:轉載
供稿:網友
<%
'**************************************************
'函數名:gotTopic
'作 用:截字符串,漢字一個算兩個字符,英文算一個字符
'參 數: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
'=========================================================
'函數:RemoveHTML(strHTML)
'功能:去除HTML標記
'參數: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
%>
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 太原市| 达孜县| 商洛市| 图片| 四平市| 宁德市| 晋城| 静宁县| 昭觉县| 沈阳市| 洛南县| 合水县| 邮箱| 武宁县| 惠安县| 宜昌市| 凤台县| 铜山县| 莱西市| 石柱| 上蔡县| 聂荣县| 曲靖市| 博兴县| 通道| 徐州市| 南丰县| 濮阳市| 威宁| 谷城县| 天等县| 商洛市| 普宁市| 金川县| 冷水江市| 陕西省| 曲阜市| 肇庆市| 赤峰市| 仁寿县| 康乐县|