当前位置: 移动技术网 > IT编程>脚本编程>VBScript > VBS教程:VBscript属性-Length 属性

VBS教程:VBscript属性-Length 属性

2017年12月12日  | 移动技术网IT编程  | 我要评论

云购推荐,电影下载网页,繁体字转换工具

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.length     retstr = retstr & "个字符。" & vbcrlf  next  regexptest = retstrend functionmsgbox(regexptest("is.", "is1 is2 is3 is4"))

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网