title: how to check if a url has a substring
body: <p>I am trying to make something that will enable all controls if a SubString in a WebBrowser matches a
  SubString in a TextBox and if it does it will enable all controls, but I can't seem to get it to work.</p>
  
  <p>This is my current code:</p>
  
  <pre><code>string str = "www.google.com";
  
  int pos = str.IndexOf(".") + 1;
  int pos2 = str.LastIndexOf(".") - 4;
  string str2 = str.Substring(pos, pos2);
  
  if (webBrowser1.Url.AbsoluteUri.Substring(pos, pos2) == textBox1.Text.Substring(pos, pos2))
  {
      foreach (Control c in Controls)
      {
          c.Enabled = true;
      }
  }
  </code></pre>
  
  <p>Any and all help will be appreciated.</p>