title: Duplicate vowels in string
body: <p>I have to write a method that takes in a String and returns a new 
  string that replaces every vowel with two occurrences of 
  that vowel.</p>
  
  <p>For example: "hello" would return "heelloo"</p>
  
  <p>I've experimented with my code for hours but I am not getting anything done. Here is my code:</p>
  
  <pre><code>public static String doubleVowel(String str)
  { 
  String result = str;
  for(int i = 0; i &lt; str.length(); i++)
  {
      if((str.charAt(i) == 'a') || 
      (str.charAt(i) == 'e')  ||
      (str.charAt(i) == 'i') || 
      (str.charAt(i) == 'o') ||
      (str.charAt(i) == 'u')) 
      {
          result = result.substring(0, i + 1) + Character.toString(result.charAt(i)) 
          + result.substring(i + 1, result.length());
          i++;
      }
  }          
  return result;
  }
  </code></pre>
  
  <p>When the input is "hello", the output is "heelllo"<br/>
  When the input is "computer" the output is "coomppuuter"<br/>
  When the input is "sweet" the output is "sweeet"<br/></p>
  
  <p>I have racked my brain but to no avail. What is causing the bug in the program, and is there a simpler way to do this?</p>