C# Search for a word occurances within a string
<p>How can I search for a word within a string ?
I have one text box which the user insert a string and another on with with text just some random text. 
Are there any alterative ways of doing this besides using <code>regex</code> and <code>IndexOf</code>? Like using a <code>for loop</code> and checking the length and character in the word.</p>

<p>This is what I tried so far            </p>

<pre><code>        int i = 0; 
        int count = 0;

        input2.Trim(); 

        while ((i = input2.IndexOf(input1, i)) != -1) 
        {
            i = i + input1.Length;
            count++; 
        }

        MessageBox.Show(count.ToString() + " Matches Found");
</code></pre>
