#42 Elliott Stansbury String Cheese

Abierta
ElliottStansbury desea fusionar 6 commits de ElliottStansbury/JavaStringCheese:master en master
Se han modificado 3 ficheros con 90 adiciones y 11 borrados
  1. BIN
      StringParser.class
  2. 53
    10
      StringParser.java
  3. 37
    1
      package.bluej

BIN
StringParser.class Ver fichero


+ 53
- 10
StringParser.java Ver fichero

@@ -4,6 +4,8 @@
4 4
  *
5 5
  * @author Wilhem Alcivar
6 6
  */
7
+
8
+//ElliottStansbury
7 9
 public class StringParser
8 10
 {
9 11
     /**
@@ -15,7 +17,8 @@ public class StringParser
15 17
      */
16 18
     public static String upperCaseString(String s)
17 19
     {
18
-        return null;
20
+
21
+        return s.toUpperCase();
19 22
     }
20 23
 
21 24
     /**
@@ -26,7 +29,7 @@ public class StringParser
26 29
      * @return String
27 30
      */
28 31
     public static String lowerCaseString(String s) {
29
-        return null;
32
+        return s.toLowerCase();
30 33
     }
31 34
 
32 35
     /**
@@ -37,7 +40,9 @@ public class StringParser
37 40
      * @return String
38 41
      */
39 42
     public static Character getFirstCharacter(String s) {
40
-        return null;
43
+        
44
+
45
+        return s.charAt(0);
41 46
     }
42 47
 
43 48
     /**
@@ -49,7 +54,9 @@ public class StringParser
49 54
      * @return String
50 55
      */
51 56
     public static Character getNthCharacter(String s, Integer n) {
52
-        return null;
57
+        char nLetter = s.charAt(n);
58
+
59
+        return nLetter;
53 60
     }
54 61
 
55 62
     /**
@@ -60,7 +67,9 @@ public class StringParser
60 67
      * @return String
61 68
      */
62 69
     public static String upperCaseFirstCharacter(String s) {
63
-        return null;
70
+        String firstLetterUpper = s.substring(0,1).toUpperCase() + s.substring(1);
71
+
72
+        return firstLetterUpper;
64 73
     }
65 74
 
66 75
     /**
@@ -72,7 +81,23 @@ public class StringParser
72 81
      * @return String
73 82
      */
74 83
     public static String camelCaseString(String s) {
75
-        return null;
84
+        String st = s.toLowerCase();
85
+        String[] arr = st.split(" ");
86
+        StringBuffer sb = new StringBuffer();
87
+
88
+        for (int i = 0; i < arr.length; i++) {
89
+            sb.append(Character.toUpperCase(arr[i].charAt(0)))
90
+            .append(arr[i].substring(1));
91
+        }          
92
+        
93
+       
94
+        
95
+        String a = sb.toString();
96
+        
97
+        
98
+        
99
+        return a;
100
+
76 101
     }
77 102
 
78 103
     /**
@@ -84,7 +109,11 @@ public class StringParser
84 109
      * @return String
85 110
      */
86 111
     public static String snakeCaseString(String s) {
87
-        return null;
112
+        String lower = s.toLowerCase();
113
+        String a = lower.replaceAll("\\s","_");
114
+        
115
+        
116
+        return a;
88 117
     }
89 118
 
90 119
     /**
@@ -95,7 +124,7 @@ public class StringParser
95 124
      * @return String
96 125
      */
97 126
     public static Integer getLength(String s) {
98
-        return null;
127
+        return s.length();
99 128
     }
100 129
 
101 130
     /**
@@ -109,7 +138,11 @@ public class StringParser
109 138
      * @return String
110 139
      */
111 140
     public static Boolean isEqual(String s1, String s2) {
112
-        return null;
141
+        if(s1.equals(s2)){
142
+            return true;
143
+        }else{
144
+        }
145
+        return false;
113 146
     }
114 147
 
115 148
     /**
@@ -123,6 +156,16 @@ public class StringParser
123 156
      * @return String
124 157
      */
125 158
     public static Boolean isEqualIgnoreCase(String s1, String s2) {
126
-        return null;
159
+        
160
+        
161
+        
162
+       
163
+        
164
+        if(s1.equalsIgnoreCase(s2)){
165
+            return true;
166
+        }else {
167
+        }
168
+        return false;
169
+        
127 170
     }
128 171
 }

+ 37
- 1
package.bluej Ver fichero

@@ -1,3 +1,39 @@
1 1
 #BlueJ package file
2
-#Wed Oct 17 09:06:47 EDT 2018
2
+editor.fx.0.height=709
3
+editor.fx.0.width=800
4
+editor.fx.0.x=240
5
+editor.fx.0.y=23
6
+objectbench.height=101
7
+objectbench.width=776
8
+package.divider.horizontal=0.6
9
+package.divider.vertical=0.8007380073800738
10
+package.editor.height=427
11
+package.editor.width=674
12
+package.editor.x=91
13
+package.editor.y=76
14
+package.frame.height=600
15
+package.frame.width=800
16
+package.numDependencies=0
17
+package.numTargets=2
18
+package.showExtends=true
19
+package.showUses=true
3 20
 project.charset=UTF-8
21
+readme.height=58
22
+readme.name=@README
23
+readme.width=47
24
+readme.x=10
25
+readme.y=10
26
+target1.height=50
27
+target1.name=StringParser
28
+target1.showInterface=false
29
+target1.type=ClassTarget
30
+target1.width=100
31
+target1.x=140
32
+target1.y=10
33
+target2.height=50
34
+target2.name=StringParserTest
35
+target2.showInterface=false
36
+target2.type=UnitTestTargetJunit4
37
+target2.width=130
38
+target2.x=70
39
+target2.y=70