Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions src/main/java/com/thealgorithms/strings/CheckVowels.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@

import java.util.Set;

/**
* Vowel Count is a system whereby character strings are placed in order based
* on the position of the characters in the conventional ordering of an
* alphabet. Wikipedia: https://en.wikipedia.org/wiki/Alphabetical_order
*/
public final class CheckVowels {
private static final Set<Character> VOWELS = Set.of('a', 'e', 'i', 'o', 'u');

private static final Set<Character> VOWELS = Set.of('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U');

private CheckVowels() {
// Private constructor to prevent instantiation
}

/**
Expand All @@ -24,7 +21,8 @@ public static boolean hasVowels(String input) {
return false;
}

for (char c : input.toLowerCase().toCharArray()) {
for (int i = 0; i < input.length(); i++) {
char c = input.charAt(i);
if (VOWELS.contains(c)) {
return true;
}
Expand Down