Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,16 @@
|
|||
Function CountSubstring(str,substr)
|
||||
CountSubstring = 0
|
||||
For i = 1 To Len(str)
|
||||
If Len(str) >= Len(substr) Then
|
||||
If InStr(i,str,substr) Then
|
||||
CountSubstring = CountSubstring + 1
|
||||
i = InStr(i,str,substr) + Len(substr) - 1
|
||||
End If
|
||||
Else
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
End Function
|
||||
|
||||
WScript.StdOut.Write CountSubstring("the three truths","th") & vbCrLf
|
||||
WScript.StdOut.Write CountSubstring("ababababab","abab") & vbCrLf
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
function CountSubstring(str,substr)
|
||||
with new regexp
|
||||
.pattern=substr
|
||||
.global=true
|
||||
set m=.execute(str)
|
||||
end with
|
||||
CountSubstring =m.count
|
||||
end function
|
||||
WScript.StdOut.Writeline CountSubstring("the three truths","th")
|
||||
WScript.StdOut.Writeline CountSubstring("ababababab","abab")
|
||||
Loading…
Add table
Add a link
Reference in a new issue