bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths

Loading lesson path

Learn/Java/Java How To's
Java•Java How To's

Java How To Remove Vowels from a String

Remove Vowels from a String

Delete all vowels ( a, e, i, o, u ) from a string (case-insensitive).

Example

String text = "Hello Java";
String result = text.replaceAll("[aeiouAEIOU]", "");
System.out.println(result);

Explanation: The regular expression [aeiouAEIOU] matches all vowels (both lowercase and uppercase). Replacing them with an empty string removes them. For "Hello Java" , the result is "Hll Jv" .

Previous

Java How To - Count Vowels in a String

Next

Java How To Count Digits in a String