源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

VBS教程:VBscript属性-Length 属性

  • 时间:2020-03-14 21:37 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:VBS教程:VBscript属性-Length 属性

Length 属性

返回在字符串搜索中找到的匹配的长度。 [code][i]object[/i].[b]Length[/b][/code] [i]object[/i] 参数总是一个 [b]Match[/b] 对象。 [h3]说明[/h3]下面的代码说明了 [b]Length[/b] 属性的用法:
[code]Function RegExpTest(patrn, strng)  Dim regEx, Match, Matches      ' [/code]建立变量。[code]  Set regEx = New RegExp         ' [/code]建立正则表达式。[code]  regEx.Pattern = patrn         ' [/code]设置模式。[code]  regEx.IgnoreCase = True         ' [/code]设置是否区分大小写。[code]  regEx.Global = True         ' [/code]设置全程可用性。[code]  Set Matches = regEx.Execute(strng)   ' [/code]执行搜索。[code]  For Each Match in Matches      ' [/code]遍历[code] Matches [/code]集合。[code]    RetStr = RetStr & "[/code]匹配[code] " & I & " [/code]位于[code] "[/code][code]    RetStr = RetStr & Match.FirstIndex & "[/code]。匹配的长度为[code]"[/code][code]    RetStr = RetStr & [b]Match.Length[/b] [/code][code]    RetStr = RetStr & "[/code]个字符。[code]" & vbCRLF[/code][code]  Next[/code][code]  RegExpTest = RetStr[/code][code]End Function[/code][code]MsgBox(RegExpTest("is.", "IS1 is2 IS3 is4"))[/code]
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部