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

VBS教程:VBscript属性-FirstIndex 属性

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

怀旧经典,51招聘网,生辰八字 名字

firstindex 属性

返回在搜索字符串中匹配的位置。

object.firstindex

object 参数总是一个 match 对象。

说明

firstindex 属性使用从零起算的偏移量,该偏移量是相对于搜索字符串的起始位置而言的。换言之,字符串中的第一个字符被标识为字符 0。 下面的例子说明了 firstindex 属性的用法:

~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 & ". match value is "'    retstr = retstr & match.value & "'." & vbcrlf  next  regexptest = retstrend functionmsgbox(regexptest("is.", "is1 is2 is3 is4"))

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

相关文章:

验证码:
移动技术网