|
@@ -43,13 +43,18 @@ public class StringUtils {
|
43
|
43
|
}
|
44
|
44
|
|
45
|
45
|
public static Boolean hasDuplicateConsecutiveCharacters(String str) {
|
46
|
|
- return null;
|
|
46
|
+ return false;
|
47
|
47
|
}
|
48
|
48
|
|
49
|
49
|
public static String removeConsecutiveDuplicateCharacters(String str) {
|
50
|
|
- boolean isContinued = true;
|
51
|
|
- String[] strArray = str.split("");
|
52
|
50
|
String fin = "";
|
|
51
|
+ String[] strArray = str.split("");
|
|
52
|
+ for(int i = 0; i < strArray.length-1; i++){
|
|
53
|
+ if(str.charAt(i) != str.charAt(i+1)){
|
|
54
|
+ fin += str.charAt(i);
|
|
55
|
+ }
|
|
56
|
+ }
|
|
57
|
+ fin += strArray[strArray.length-1];
|
53
|
58
|
return fin;
|
54
|
59
|
}
|
55
|
60
|
|