Skip to content

Commit

Permalink
2020-05-06-StringSplit-Modify-code-for-passing-all-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JinHoooooou committed May 6, 2020
1 parent 084cb10 commit 2f35e93
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/splitStrings_20200506/StringSplit.java
Expand Up @@ -3,7 +3,9 @@
public class StringSplit {

public static String[] solution(String s) {

if (s.length() % 2 == 1) {
s = s + "_";
}
String[] result = new String[s.length() / 2];
for (int i = 0; i < result.length; i++) {
String target = s.substring(0, 2);
Expand Down
2 changes: 1 addition & 1 deletion src/splitStrings_20200506/StringSplitTest.java
Expand Up @@ -18,7 +18,7 @@ public void test1() {
}

@Test
@DisplayName("test should return {ab,cd,e_} when input \"abcdef\" ")
@DisplayName("test should return {ab,cd,e_} when input \"abcde\" ")
public void test2() {
// Given: Set string "abcde"
String given = "abcde";
Expand Down

0 comments on commit 2f35e93

Please sign in to comment.