Skip to content

Commit

Permalink
Added back tick and moved String builder declaration down.
Browse files Browse the repository at this point in the history
Signed-off-by: mitchellg <mitchellg@bitquilltech.com>
  • Loading branch information
MitchellGale committed Jul 22, 2022
1 parent 1fadb92 commit 1a7c927
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ public static String unquoteText(String text) {
return text;
}

StringBuilder textSB = new StringBuilder();

char enclosingQuote;
char firstChar = text.charAt(0);
char lastChar = text.charAt(text.length() - 1);
Expand All @@ -60,6 +58,8 @@ public static String unquoteText(String text) {
char currentChar;
char nextChar;

StringBuilder textSB = new StringBuilder();

// Ignores first and last character as they are the quotes that should be removed
for (int chIndex = 1; chIndex < text.length() - 1; chIndex++) {
currentChar = text.charAt(chIndex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ void unquoteTest() {

assertEquals("hello'", unquoteText("'hello''"));
assertEquals("don't", unquoteText("'don't'"));
assertEquals("hello`", unquoteText("`hello``"));
assertEquals("don\"t", unquoteText("\"don\"t\""));

}

Expand Down

0 comments on commit 1a7c927

Please sign in to comment.