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: 
```
str="Thisissumlivinginsumgjhvgsum in the sum bcoz sum ot ih sum"
b= LCase(str)
array1=Split(b,"sum")
l=Ubound(array1)
msgbox l

```

the output gives u the no. of occurences of a string within another one.
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

```