The code bellow removes the vowels form the string but it does not remove the spaces that corresponds before or after the "_".
public static String removeVowels(String str) {
str = str.replaceAll("[aeiouAEIOU]","");
return str;
}
public static void main(String[] args) {
System.out.println("__" + removeVowels(" The Lion king ") + "__");
}
}
Console Output:
__ Th Ln kng __
What the console output should be:
__Th Ln kng__
Not really sure how I would go about doing this without going into the main method and manually removing the spaces.