title: Searching a string for a substring using charAt
body: <p>CS student here. As usual I'm puzzled. My task is to use only .charAt() and .length() to search a string for a substring (both provided by the user). What it ought to return is the begin index of the substring in the string (or -1 if it isn't present at all). Frankly, I'm not sure where to begin. I attempted doing something like the following:</p>
  <pre><code>for (int i=0;i&lt;string.length();i++)
      if (string.charAt(i) == substring.charAt(i))
  </code></pre>
  <p>If that was true then I wanted to do something like compare the next two characters in the respective strings. Am I way off base here? Any advice on how to get off the ground?</p>
  <p>Thanks for reading.</p>