当前位置:主页 > 查看内容

计算一个字符串在另一字符串中出现的次数函数

发布时间:2021-07-17 00:00| 位朋友查看

简介:Functionstrnum(patrn,strng) DimregEx,Match,Matches,xx xx=0 SetregEx=NewRegExp regEx.Pattern=patrn regEx.IgnoreCase=True'设置是否区分大小写。 regEx.Global=True SetMatches=regEx.Execute(strng) ForEachMatchinMatches xx=xx+1 Next strnum=xx End……
Function strnum(patrn, strng)
  Dim regEx, Match, Matches,xx
    xx=0
  Set regEx = New RegExp
  regEx.Pattern = patrn
  regEx.IgnoreCase = True            ' 设置是否区分大小写。
  regEx.Global = True
  Set Matches = regEx.Execute(strng)
  For Each Match in Matches
    xx=xx+1
  Next
  strnum = xx
End Function

原文链接:https://m.jb51.net/article/13692.htm
本站部分内容转载于网络,版权归原作者所有,转载之目的在于传播更多优秀技术内容,如有侵权请联系QQ/微信:153890879删除,谢谢!
上一篇:PHP设计模式之单例模式入门与应用详解 下一篇:没有了

推荐图文


随机推荐