Browse Source

StringUtils

Nathan Hall 6 years ago
parent
commit
f3f3d24711

+ 39
- 0
src/main/java/rocks/zipcode/io/quiz3/arrays/TicTacToe.java View File

@@ -4,8 +4,47 @@ package rocks.zipcode.io.quiz3.arrays;
4 4
  * @author leon on 09/12/2018.
5 5
  */
6 6
 public class TicTacToe {
7
+    private String[][] board;
8
+    private Integer value;
9
+    private Integer rowIndex;
10
+    private Integer columnIndex;
11
+
12
+    public TicTacToe(){}
7 13
 
8 14
     public TicTacToe(String[][] board) {
15
+        this.board = board;
16
+    }
17
+
18
+    public String[][] getBoard() {
19
+        return board;
20
+    }
21
+
22
+    public void setBoard(String[][] board) {
23
+        this.board = board;
24
+    }
25
+
26
+    public Integer getValue() {
27
+        return value;
28
+    }
29
+
30
+    public void setValue(Integer value) {
31
+        this.value = value;
32
+    }
33
+
34
+    public Integer getRowIndex() {
35
+        return rowIndex;
36
+    }
37
+
38
+    public void setRowIndex(Integer rowIndex) {
39
+        this.rowIndex = rowIndex;
40
+    }
41
+
42
+    public Integer getColumnIndex() {
43
+        return columnIndex;
44
+    }
45
+
46
+    public void setColumnIndex(Integer columnIndex) {
47
+        this.columnIndex = columnIndex;
9 48
     }
10 49
 
11 50
     public String[] getRow(Integer value) {

+ 18
- 1
src/main/java/rocks/zipcode/io/quiz3/arrays/WaveGenerator.java View File

@@ -5,6 +5,23 @@ package rocks.zipcode.io.quiz3.arrays;
5 5
  */
6 6
 public class WaveGenerator {
7 7
     public static String[] wave(String str) {
8
-        return null;
8
+        String[] s = new String[str.length()];
9
+        for (String s1 : s){
10
+            s1 = str;
11
+            System.out.println(s1);
12
+        }
13
+
14
+        String big = "";
15
+
16
+        for (int j = 0; j < s.length; j++) {
17
+            for (int i = 0; i < str.length() ; i++) {
18
+                s[i].toLowerCase();
19
+                if (i == j){
20
+                    String.valueOf(s[i].charAt(j)).toUpperCase();
21
+                }
22
+            }
23
+        }
24
+
25
+        return s;
9 26
     }
10 27
 }

+ 10
- 2
src/main/java/rocks/zipcode/io/quiz3/fundamentals/StringUtils.java View File

@@ -5,10 +5,18 @@ package rocks.zipcode.io.quiz3.fundamentals;
5 5
  */
6 6
 public class StringUtils {
7 7
     public static String capitalizeNthCharacter(String str, Integer indexToCapitalize) {
8
-        return null;
8
+        String s =
9
+                str.substring(0, indexToCapitalize) + String.valueOf(str.charAt(indexToCapitalize)).toUpperCase() + str.substring(indexToCapitalize + 1);
10
+
11
+           return s;
9 12
     }
10 13
 
11 14
     public static Boolean isCharacterAtIndex(String baseString, Character characterToCheckFor, Integer indexOfString) {
12
-        return null;
15
+        baseString = baseString.toLowerCase();
16
+        if (baseString.charAt(indexOfString) == characterToCheckFor){
17
+
18
+            return true;
19
+        }
20
+        return false;
13 21
     }
14 22
 }