title: Substring index and length must refer to a location within the string
body: <p>I have a string that looks like</p>
  <pre><code>string url = &quot;www.example.com/aaa/bbb.jpg&quot;;
  </code></pre>
  <p>&quot;www.example.com/&quot; is 18 fixed in length. I want to get the &quot;aaa/bbb&quot; part from this string (The actual url is not example nor aaa/bbb though, the length may vary)</p>
  <p>so here's what I did:</p>
  <pre><code>string newString = url.Substring(18, url.Length - 4);
  </code></pre>
  <p>Then I got the exception: index and length must refer to a location within the string. What's wrong with my code and how to fix it?</p>