Java Program To Remove Vowels From String
Chapter:
Interview Programs
Last Updated:
05-11-2016 13:52:39 UTC
Program:
/* ............... START ............... */
public class JavaProgramToRemoveAllVowels {
public static void main(String[] args) {
String string = "RemoveVowels";
String resultString = string.replaceAll("[aeiouAEIOU]", "");
System.out.println(resultString);
}
}
/* ............... END ............... */
Output
Notes:
-
To remove vowels from a string we can use predefined method of string replaceAll()
- By passing all vowels to the method replaceAll() with empty it will replaces all vowels with empty.
Tags
Remove Vowels From String, Java, Interview Programs