VBS教程:VBscript屬性-Length 屬性
更新時間:2006年11月16日 00:00:00 作者:
Length 屬性
返回在字符串搜索中找到的匹配的長度。
object.Length
object 參數(shù)總是一個 Match 對象。
說明
下面的代碼說明了 Length 屬性的用法:
Function RegExpTest(patrn, strng) Dim regEx, Match, Matches '
建立變量。Set regEx = New RegExp '
建立正則表達(dá)式。regEx.Pattern = patrn '
設(shè)置模式。regEx.IgnoreCase = True '
設(shè)置是否區(qū)分大小寫。regEx.Global = True '
設(shè)置全程可用性。Set Matches = regEx.Execute(strng) '
執(zhí)行搜索。For Each Match in Matches '
遍歷Matches
集合。RetStr = RetStr & "
匹配" & I & "
位于"
RetStr = RetStr & Match.FirstIndex & "
。匹配的長度為"
RetStr = RetStr & Match.Length
RetStr = RetStr & "
個字符。" & vbCRLF
Next
RegExpTest = RetStr
End Function
MsgBox(RegExpTest("is.", "IS1 is2 IS3 is4"))
相關(guān)文章
VBScript Enun Remote CMD Shell代碼
Enun Remote CMDShell,喜歡玩cmdshell的朋友可以參考下2013-07-07vbs ShellExecute運(yùn)行外部程序時如何判斷外部程序執(zhí)行成功與否
這篇文章主要介紹了vbs ShellExecute運(yùn)行外部程序時如何判斷外部程序執(zhí)行成功與否,需要的朋友可以參考下2023-06-06VBS中CreateObject和WScript.CreateObject的區(qū)別介紹
很多VBS新手都很困惑CreateObject和WScript.CreateObject有什么區(qū)別,為什么一些代碼中用CreateObject,而另一些卻用WScript.CreateObject2013-05-05VBS 腳本中的字典、動態(tài)數(shù)組、隊列和堆棧實現(xiàn)代碼
今天用VBS腳本寫了幾個程序,用到了字典(Dictionary)、動態(tài)數(shù)組(ArrayList)、隊列(Queue)和堆棧(Stack)?,F(xiàn)在寫篇Blog總結(jié)一下 ,需要的朋友可以參考下2018-05-05