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
I know this thread is really old, but I got another solution too:
Function countOccurencesOf(needle As String, s As String)
Dim count As Integer = 0
For i As Integer = 0 to s.Length - 1
If s.Substring(i).Startswith(needle) Then
count = count + 1
End If
Next
Return count
End Function