title: Given two strings, base and remove, return a version of the base string where all instances of the remove string have been removed
body: <p>Given two strings, <code>base</code> and <code>remove</code>, return a version of the <code>base</code> string where all instances of the <code>remove</code> string have been removed (not case sensitive). </p>
  
  <p>You may assume that the remove string is length 1 or more. Remove only non-overlapping instances, so with <code>"xxx"</code> removing <code>"xx"</code> leaves <code>"x"</code>. 
  For example,</p>
  
  <pre><code>withoutString("Hello there", "llo") → "He there"
  withoutString("Hello there", "e") → "Hllo thr"
  withoutString("Hello there", "x") → "Hello there"
  </code></pre>
  
  <p>But Im failing most of the test cases here in codingbat. Could anybody please help me?</p>
  
  <pre><code>public String withoutString(String base, String remove) {
  
     String result = "";
     for(int i = 0; i &lt; base.length() - remove.length(); i++){
        if(!(base.substring(i, i + remove.length()).equalsIgnoreCase(remove))){
           result += base.substring(i, i + 1);
        }
        else{
           i = i + remove.length();
        }
     }
  
     return result;
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/q2XF6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/q2XF6.png" alt="enter image description here"></a></p>