Since I haven't seen Khult on for a while I'm just gonna make this topic
I made a program to remove vowels out of a phrase someone types. It works perfectly fine but the way I did it was a bit clunky. So what could I do to reduce the wall of code and make it... better. Here's the code, hope someone can help!
I made a program to remove vowels out of a phrase someone types. It works perfectly fine but the way I did it was a bit clunky. So what could I do to reduce the wall of code and make it... better. Here's the code, hope someone can help!
- Code:
import java.util.*;
public class Tester{
public static void main(String[] args){
Scanner Input = new Scanner(System.in);
System.out.print("Enter a phrase >> ");
String Phrase = Input.nextLine();
Phrase = Phrase.replaceAll("a", "");
Phrase = Phrase.replaceAll("A", "");
Phrase = Phrase.replaceAll("e", "");
Phrase = Phrase.replaceAll("E", "");
Phrase = Phrase.replaceAll("i", "");
Phrase = Phrase.replaceAll("I", "");
Phrase = Phrase.replaceAll("o", "");
Phrase = Phrase.replaceAll("O", "");
Phrase = Phrase.replaceAll("u", "");
Phrase = Phrase.replaceAll("U", "");
System.out.println(Phrase);
}
}