mpierse 6 vuotta sitten
vanhempi
commit
2c8120691b

+ 10
- 1
src/main/java/rocks/zipcode/io/quiz3/arrays/WaveGenerator.java Näytä tiedosto

1
 package rocks.zipcode.io.quiz3.arrays;
1
 package rocks.zipcode.io.quiz3.arrays;
2
 
2
 
3
+import java.util.ArrayList;
4
+
3
 /**
5
 /**
4
  * @author leon on 09/12/2018.
6
  * @author leon on 09/12/2018.
5
  */
7
  */
6
 public class WaveGenerator {
8
 public class WaveGenerator {
7
     public static String[] wave(String str) {
9
     public static String[] wave(String str) {
8
-        return null;
10
+        str = str.toLowerCase();
11
+        ArrayList<String> result = new ArrayList<>();
12
+        for (int i = 0; i < str.length(); i++) {
13
+            if(str.charAt(i) >= 97 && str.charAt(i) <= 122){
14
+                result.add(str.substring(0,i) + (str.substring(i,i+1).toUpperCase()) + str.substring(i+1));
15
+            }
16
+        }
17
+        return result.toArray(new String[0]);
9
     }
18
     }
10
 }
19
 }