User-821857111 posted
The best tool for this job is Regular Expressions:
Dim input = File.ReadAllText("D:\check.txt")
Dim pattern = "\bcar\b"
Dim matches = Regex.Matches(input, pattern)
Dim count = matches.Count
The pattern will find car as a whole word so that it will be found in "My fast car", but not in "Sweet Caroline".
You have a Response.Redirect in your code which means that as soon as the code finds a match, your page code will stop executing and the user will be redirected to another page. You will never be able to count all the occurrences of the string that you want
to find.