|
|
@@ -152,10 +152,24 @@ public class StringArrayUtils {
|
|
152
|
152
|
* @return array with identical contents excluding values of `value`
|
|
153
|
153
|
*/ // TODO
|
|
154
|
154
|
public static String[] removeValue(String[] array, String valueToRemove) {
|
|
|
155
|
+ StringBuilder sb = new StringBuilder();
|
|
155
|
156
|
|
|
|
157
|
+ //Looping through array
|
|
|
158
|
+ for(int index = 0;index < array.length;index++){
|
|
|
159
|
+ //if the array value does not equal
|
|
|
160
|
+ //the value to remove, then add the values to a temp array
|
|
|
161
|
+
|
|
|
162
|
+ if(array[index] != valueToRemove ){
|
|
|
163
|
+ sb.append(array[index] + "~");
|
|
|
164
|
+
|
|
|
165
|
+ }
|
|
|
166
|
+
|
|
|
167
|
+
|
|
|
168
|
+ }
|
|
|
169
|
+ String answer = sb.toString();
|
|
156
|
170
|
|
|
157
|
|
-
|
|
158
|
|
- return null;
|
|
|
171
|
+ String [] temp = answer.split("~");
|
|
|
172
|
+ return temp;
|
|
159
|
173
|
}
|
|
160
|
174
|
|
|
161
|
175
|
/**
|
|
|
@@ -163,6 +177,9 @@ public class StringArrayUtils {
|
|
163
|
177
|
* @return array of Strings with consecutive duplicates removes
|
|
164
|
178
|
*/ // TODO
|
|
165
|
179
|
public static String[] removeConsecutiveDuplicates(String[] array) {
|
|
|
180
|
+
|
|
|
181
|
+
|
|
|
182
|
+
|
|
166
|
183
|
return null;
|
|
167
|
184
|
}
|
|
168
|
185
|
|