Nathan Hall před 6 roky
rodič
revize
e0510a869e

+ 22
- 3
src/main/java/rocks/zipcode/io/quiz3/fundamentals/VowelUtils.java Zobrazit soubor

@@ -5,19 +5,38 @@ package rocks.zipcode.io.quiz3.fundamentals;
5 5
  */
6 6
 public class VowelUtils {
7 7
     public static Boolean hasVowels(String word) {
8
-        return null;
8
+        for (int i = 0; i < word.length(); i++) {
9
+            if (String.valueOf(word.charAt(i)).matches("[AEIOUaeiou]")){
10
+                return true;
11
+            }
12
+
13
+        }
14
+
15
+        return false;
9 16
     }
10 17
 
11 18
     public static Integer getIndexOfFirstVowel(String word) {
19
+        String check = "";
20
+        for (int i = 0; i < word.length(); i++) {
21
+            if (String.valueOf(word.charAt(i)).matches("[AEIOUaeiou]")){
22
+                return i;
23
+            }
24
+        }
12 25
         return null;
13 26
     }
14 27
 
15 28
 
16 29
     public static Boolean startsWithVowel(String word) {
17
-        return null;
30
+        if (String.valueOf(word.charAt(0)).matches("[AEIOUaeiou]")){
31
+            return true;
32
+        }
33
+        return false;
18 34
     }
19 35
 
20 36
     public static Boolean isVowel(Character character) {
21
-        return null;
37
+        if (String.valueOf(character).matches("[AEIOUaeiou]")){
38
+            return true;
39
+        }
40
+        return false;
22 41
     }
23 42
 }