Can you please explain me how do i find in a simple way the number of times that a certain string occurs inside a big string? Example:
string longString = "hello1 hello2 hello546 helloasdf";
The word "hello" is there four times. how can i get the number four. Thanks
EDIT: I would like to know how i find a two word string as well for example:
string longString = "hello there hello2 hello4 helloas hello there";
I want to know the number of occurrences of "hello there".
EDIT 2: The regex method was the best for me (with the counts) but it does not find a word like this for example: ">word<" . Somehow, if I want to search for a word containing "<>" it skips it. Help?