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

主頁 > 知識庫 > asp之自動閉合HTML/ubb標簽函數 附簡單注釋

asp之自動閉合HTML/ubb標簽函數 附簡單注釋

熱門標簽:騰訊地圖標注商戶關閉 智能電銷機器人適用于哪些行業 武漢營銷電話機器人軟件 地圖標注服務哪家好 長沙防封電銷卡品牌 徐州人工智能電銷機器人好用嗎 外呼系統還用卡么 西寧公司外呼系統平臺 地圖標注宅基地
這最近在PJ的function庫里看到的這個函數,感覺思路差了點,不過相對比較完美,只是閉合標簽時的順序問題,呵呵
修改一下數組arrTags里的各元素內容,可以達到閉合任何標簽的功能。
在此,我給增加了一些注釋,方便大家一起學習學習
復制代碼 代碼如下:

Function closeUBB(strContent)
'*************************************
'自動閉合UBB
'*************************************
Dim arrTags, i, OpenPos, ClosePos, re, strMatchs, j, Match
Set re = New RegExp '申明re對象
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
Set re = Nothing
End Function

closehtml的注釋同上
復制代碼 代碼如下:

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
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
Set re = Nothing
End Function
您可能感興趣的文章:
  • PHP實現HTML標簽自動補全代碼
  • asp自動補全html標簽自動閉合(正則表達式)
  • js自動閉合html標簽(自動補全html標記)
  • asp之自動閉合HTML/ubb標簽函數附簡單注釋
  • php使HTML標簽自動補全閉合函數代碼

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

巨人網絡通訊聲明:本文標題《asp之自動閉合HTML/ubb標簽函數 附簡單注釋》,本文關鍵詞  asp,之,自動,閉合,HTML,ubb,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《asp之自動閉合HTML/ubb標簽函數 附簡單注釋》相關的同類信息!
  • 本頁收集關于asp之自動閉合HTML/ubb標簽函數 附簡單注釋的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 临安市| 泽普县| 罗源县| 乌拉特后旗| 安化县| 苍梧县| 衡阳市| 鄂州市| 平舆县| 晋中市| 山东省| 安福县| 察哈| 财经| 济源市| 吉安县| 辰溪县| 上虞市| 海城市| 长沙市| 衡阳市| 手机| 昆明市| 井冈山市| 宁晋县| 福清市| 体育| 成武县| 金湖县| 磐石市| 鄂伦春自治旗| 西藏| 南投县| 乡宁县| 吉林省| 商都县| 吉水县| 安图县| 都匀市| 新源县| 广东省|