Jump to content

How do I find the number of substrings in a string?

Recommended Posts

I am trying to find the number of occurences of a string within the body tags of an HTML page. There will always be at least one and less than 22: (the code below is just one of many things I have tried. I also tried a Do loop -- which I think is what I want -- but no worky)

Func NumberOfStrings()

$StringToSearch = _IEBodyReadHTML($o_IE)
$x = 1
$y = 1
For $y = 1 to 22
    StringInStr ($StringToSearch, "MySubString", 0, $x)
    $x = $x + 1
         If @error = 1 Then  ; StringInStr() failed
SplashTextOn("Instances of MySubString", $x)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...