|
@@ -1,10 +1,19 @@
|
1
|
1
|
package rocks.zipcode.io.quiz3.arrays;
|
2
|
2
|
|
|
3
|
+import java.util.ArrayList;
|
|
4
|
+
|
3
|
5
|
/**
|
4
|
6
|
* @author leon on 09/12/2018.
|
5
|
7
|
*/
|
6
|
8
|
public class WaveGenerator {
|
7
|
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
|
}
|