婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > asp之自動閉合HTML/ubb標(biāo)簽函數(shù)附簡單注釋

asp之自動閉合HTML/ubb標(biāo)簽函數(shù)附簡單注釋

熱門標(biāo)簽:地圖標(biāo)注宅基地 西寧公司外呼系統(tǒng)平臺 騰訊地圖標(biāo)注商戶關(guān)閉 外呼系統(tǒng)還用卡么 徐州人工智能電銷機器人好用嗎 地圖標(biāo)注服務(wù)哪家好 武漢營銷電話機器人軟件 智能電銷機器人適用于哪些行業(yè) 長沙防封電銷卡品牌
Function closeUBB(strContent)
'*************************************
'自動閉合UBB
'*************************************
Dim arrTags, i, OpenPos, ClosePos, re, strMatchs, j, Match
Set re = New RegExp '申明re對象
re.IgnoreCase = True '設(shè)置是否區(qū)分字符大小寫
re.Global = True '設(shè)置全局可用性
arrTags = Array("code", "quote", "list", "color", "align", "font", "size", "b", "i", "u", "html") '建立數(shù)組,存儲相關(guān)需要檢測是否閉合的標(biāo)簽
For i = 0 To UBound(arrTags) '循環(huán)對數(shù)組里的每一個元素進(jìn)行檢測
OpenPos = 0 '初始化當(dāng)前標(biāo)簽開始標(biāo)記的個數(shù)
ClosePos = 0 '初始化當(dāng)前標(biāo)簽結(jié)束標(biāo)記的個數(shù)
re.Pattern = "\[" + arrTags(i) + "(=[^\[\]]+|)\]" '開始分別正則判斷開始與結(jié)束標(biāo)記的個數(shù)
Set strMatchs = re.Execute(strContent)
For Each Match in strMatchs
OpenPosOpenPos = OpenPos + 1
Next
re.Pattern = "\[/" + arrTags(i) + "\]"
Set strMatchs = re.Execute(strContent)
For Each Match in strMatchs
ClosePosClosePos = ClosePos + 1
Next
For j = 1 To OpenPos - ClosePos '當(dāng)開始與結(jié)束標(biāo)記數(shù)量不一致時,閉合當(dāng)前標(biāo)簽
strContentstrContent = strContent + "[/" + arrTags(i) + "]"
Next
Next
closeUBB = strContent
Set re = Nothing
End Function

程序代碼
Function closeHTML(strContent)
'*************************************
'自動閉合HTML
'*************************************
Dim arrTags, i, OpenPos, ClosePos, re, strMatchs, j, Match
Set re = New RegExp
re.IgnoreCase = True
re.Global = True
arrTags = Array("p", "div", "span", "table", "ul", "font", "b", "u", "i", "h1", "h2", "h3", "h4", "h5", "h6")
For i = 0 To UBound(arrTags)
OpenPos = 0
ClosePos = 0
re.Pattern = "\" + arrTags(i) + "( [^\\>]+|)\&;"
Set strMatchs = re.Execute(strContent)
For Each Match in strMatchs
OpenPosOpenPos = OpenPos + 1
Next
re.Pattern = "\/" + arrTags(i) + "\&;"
Set strMatchs = re.Execute(strContent)
For Each Match in strMatchs
ClosePosClosePos = ClosePos + 1
Next
For j = 1 To OpenPos - ClosePos
strContentstrContent = strContent + "/" + arrTags(i) + ">"
Next
Next
closeHTML = strContent
Set re = Nothing
End Function
下面的是pjblog的函數(shù)代碼,但沒有注釋,學(xué)習(xí)研究建議參考上面的注釋
復(fù)制代碼 代碼如下:

'*************************************
'自動閉合UBB
'*************************************

Function closeUBB(strContent)
Dim arrTags, i, OpenPos, ClosePos, re, strMatchs, j, Match
Set re = New RegExp
re.IgnoreCase = True
re.Global = True
arrTags = Array("code", "quote", "list", "color", "align", "font", "size", "b", "i", "u", "html")
For i = 0 To UBound(arrTags)
OpenPos = 0
ClosePos = 0

re.Pattern = "\[" + arrTags(i) + "(=[^\[\]]+|)\]"
Set strMatchs = re.Execute(strContent)
For Each Match in strMatchs
OpenPos = OpenPos + 1
Next
re.Pattern = "\[/" + arrTags(i) + "\]"
Set strMatchs = re.Execute(strContent)
For Each Match in strMatchs
ClosePos = ClosePos + 1
Next
For j = 1 To OpenPos - ClosePos
strContent = strContent + "[/" + arrTags(i) + "]"
Next
Next
closeUBB = strContent
End Function

'*************************************
'自動閉合HTML
'*************************************

Function closeHTML(strContent)
Dim arrTags, i, OpenPos, ClosePos, re, strMatchs, j, Match
Set re = New RegExp
re.IgnoreCase = True
re.Global = True
arrTags = Array("p", "div", "span", "table", "ul", "font", "b", "u", "i", "h1", "h2", "h3", "h4", "h5", "h6")
For i = 0 To UBound(arrTags)
OpenPos = 0
ClosePos = 0

re.Pattern = "\" + arrTags(i) + "( [^\\>]+|)\&;"
Set strMatchs = re.Execute(strContent)
For Each Match in strMatchs
OpenPos = OpenPos + 1
Next
re.Pattern = "\/" + arrTags(i) + "\&;"
Set strMatchs = re.Execute(strContent)
For Each Match in strMatchs
ClosePos = ClosePos + 1
Next
For j = 1 To OpenPos - ClosePos
strContent = strContent + "/" + arrTags(i) + ">"
Next
Next
closeHTML = strContent
End Function
您可能感興趣的文章:
  • PHP實現(xiàn)HTML標(biāo)簽自動補全代碼
  • asp自動補全html標(biāo)簽自動閉合(正則表達(dá)式)
  • js自動閉合html標(biāo)簽(自動補全html標(biāo)記)
  • asp之自動閉合HTML/ubb標(biāo)簽函數(shù) 附簡單注釋
  • php使HTML標(biāo)簽自動補全閉合函數(shù)代碼

標(biāo)簽:鷹潭 荊門 雅安 巴彥淖爾 通遼 運城 普洱 通化

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《asp之自動閉合HTML/ubb標(biāo)簽函數(shù)附簡單注釋》,本文關(guān)鍵詞  asp,之,自動,閉合,HTML,ubb,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《asp之自動閉合HTML/ubb標(biāo)簽函數(shù)附簡單注釋》相關(guān)的同類信息!
  • 本頁收集關(guān)于asp之自動閉合HTML/ubb標(biāo)簽函數(shù)附簡單注釋的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 双桥区| 张家界市| 崇州市| 高雄县| 平安县| 土默特左旗| 观塘区| 三原县| 嘉义县| 和林格尔县| 英吉沙县| 静宁县| 龙门县| 家居| 武汉市| 兴安盟| 祁阳县| 昌吉市| 姜堰市| 清流县| 喜德县| 山东| 道真| 兴文县| 开江县| 伽师县| 南部县| 广水市| 衡山县| 汨罗市| 安徽省| 囊谦县| 宿迁市| 凤冈县| 南开区| 隆尧县| 宝丰县| 林州市| 周宁县| 蒲江县| 枣阳市|