Commit 6fc7c7a4 authored by Ahmed Ashour's avatar Ahmed Ashour Committed by skylot

chore: don't create unneeded StringBuilder (PR #541)

parent 98dbd488
......@@ -16,11 +16,13 @@ public class StringUtils {
return "\"\"";
}
StringBuilder res = new StringBuilder();
res.append('"');
for (int i = 0; i < len; i++) {
int c = str.charAt(i) & 0xFFFF;
processChar(c, res);
}
return '"' + res.toString() + '"';
res.append('"');
return res.toString();
}
public String unescapeChar(char ch) {
......@@ -28,8 +30,10 @@ public class StringUtils {
return "'\\\''";
}
StringBuilder res = new StringBuilder();
res.append('\'');
processChar(ch, res);
return '\'' + res.toString() + '\'';
res.append('\'');
return res.toString();
}
private void processChar(int c, StringBuilder res) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment