title: Trim a possible prefix of a string in Java
body: <p>I have <code>String str</code>, from which I want to extract the sub-string excluding a possible prefix <code>"abc"</code>.</p>
  
  <p><strong>The first solution that comes to mind is:</strong></p>
  
  <pre><code>if (str.startsWith("abc"))
      return str.substring("abc".length());
  return str;
  </code></pre>
  
  <p><strong>My questions are:</strong></p>
  
  <ol>
  <li><p>Is there a "cleaner" way to do it using <code>split</code> and a regular expression for an <code>"abc"</code> <strong>prefix</strong>?</p></li>
  <li><p>If yes, is it less efficient than the method above (because it searches "throughout" the string)?</p></li>
  <li><p>If yes, is there any better way of doing it (where "better way" = clean and efficient solution)?</p></li>
  </ol>
  
  <p>Please note that the <code>"abc"</code> prefix may appear elsewhere in the string, and should not be removed.</p>
  
  <p>Thanks</p>