jmorwick / codecafe

A web application and framework for teaching programming fundamentals
GNU General Public License v3.0
2 stars 1 forks source link

bug in evaluating some method definitions #33

Open jmorwick opened 5 years ago

jmorwick commented 5 years ago

value returned for goals is "null" for noVowels exercise with the following input:

` static String noVowels(String str) { Character vowels[] = {'a', 'e', 'i', 'o', 'u','A','E','I','O','U'};

     List<Character> al = Arrays.asList(vowels);   // *** OFFENDING LINE

     StringBuffer sb = new StringBuffer(str); 

     for (int i = 0; i < sb.length(); i++) { 

         if(al.contains(sb.charAt(i))){ 
            sb.replace(i, i+1, "") ; 
            i--; 
         } 
    } 

    return sb.toString(); 
} `