 <p>There are a few of things I can see to improve this</p> <ul> <li>Before looping, check if the substring is 0 length, if so return false (dont check every iteration)</li> <li>Remove <strong>ALL</strong> <code>== true</code>'s its basically comparing a boolean against a boolean</li> <li>Use <a href="http://msdn.microsoft.com/en-us/library/k8b1470s.aspx" rel="nofollow">IndexOf</a> to find the first character of your substring (return false if result of indexOf is -1) and then use this index as the starting value for i</li> <li><p>I believe instead of the <code>j</code> variable you can just increment <code>i</code> but I've not tested this</p> <pre><code>if (FoundMatch) return true; </code></pre></li> </ul>