bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

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

Java How To Remove Vowels from a String

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind Java How To Remove Vowels from a String?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Fill blank

Complete the missing token from the example code.

___ text = "Hello Java";
3Order

Put the learning moves in the order that makes the concept easiest to apply.

Explanation: The regular expression [aeiouAEIOU] matches all vowels (both lowercase and uppercase).
Delete all vowels ( a, e, i, o, u ) from a string (case-insensitive).
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