VBS教程:VBscript属性-Length 属性
更新时间:2006年11月16日 00:00:00 作者:
Length 属性
返回在字符串搜索中找到的匹配的长度。
object.Length
object 参数总是一个 Match 对象。
说明
下面的代码说明了 Length 属性的用法:
Function RegExpTest(patrn, strng) Dim regEx, Match, Matches '建立变量。Set regEx = New RegExp '建立正则表达式。regEx.Pattern = patrn '设置模式。regEx.IgnoreCase = True '设置是否区分大小写。regEx.Global = True '设置全程可用性。Set Matches = regEx.Execute(strng) '执行搜索。For Each Match in Matches '遍历Matches集合。RetStr = RetStr & "匹配" & I & "位于"RetStr = RetStr & Match.FirstIndex & "。匹配的长度为"RetStr = RetStr & Match.LengthRetStr = RetStr & "个字符。" & vbCRLFNextRegExpTest = RetStrEnd FunctionMsgBox(RegExpTest("is.", "IS1 is2 IS3 is4"))
相关文章
使用 Iisext.vbs 删除 Web 服务扩展文件的方法
这篇文章主要介绍了如何使用 iisext.vbs 从本地或远程计算机上删除 Web 服务扩展文件,需要的朋友可以参考下2014-07-07
VBScript教程 第十二课VBScript页面的简单样例
VBScript教程 第十二课VBScript页面的简单样例...2006-11-11


最新评论