Question: I have a string (for example: `"Hello there. My name is John. I work very hard. Hello there!"`) and I am trying to find the number of occurrences of the string `"hello there"`. So far, this is the code I have:

```vb.net
Dim input as String = "Hello there. My name is John. I work very hard. Hello there!"
Dim phrase as String = "hello there"
Dim Occurrences As Integer = 0

If input.toLower.Contains(phrase) = True Then
    Occurrences = input.Split(phrase).Length      
    'REM: Do stuff
End If

```

Unfortunately, what this line of code seems to do is split the string every time it sees the first letter of `phrase`, in this case, `h`. So instead of the result `Occurrences = 2` that I would hope for, I actually get a much larger number. I know that counting the number of splits in a string is a horrible way to go about doing this, even if I did get the correct answer, so could someone please help me out and provide some assistance?

Answer: 
You just have to change the input of the split function into a string array and then delare the `StringSplitOptions`.

Try out this line of code:

```
Occurrences = input.Split({phrase}, StringSplitOptions.None).Length

```

I haven't checked this, but I'm thinking you'll also have to account for the fact that occurrences would be too high due to the fact that you're splitting using your string and not actually counting how many times it is in the string, so **I think** `Occurrences = Occurrences - 1`

Hope this helps
I don't know if this is more obvious? 
Starting from the beginning of `longString` check the next characters up to the number characters in `phrase`, if `phrase` is not found start looking from the second character etc. If it is found start agin from the current position plus the number of characters in `phrase` and increment the value of `occurences`

```
 Module Module1
Sub Main()

    Dim longString As String = "Hello there. My name is John. I work very hard. Hello there! Hello therehello there"

    Dim phrase As String = "hello There"

    Dim occurences As Integer = 0
    Dim n As Integer = 0

    Do Until n >= longString.Length - (phrase.Length - 1)
        If longString.ToLower.Substring(n, phrase.Length).Contains(phrase.ToLower) Then
            occurences += 1
            n = n + (phrase.Length - 1)
        End If
        n += 1
    Loop
    Console.WriteLine(occurences)

End Sub
End Module

```