@Test public void testAppendEscapingQuotes() { StringBuilder sb = new StringBuilder(); StringBuilderUtils.appendEscapingQuotes(sb, "a\"b"); assertEquals("a\\\"b", sb.toString()); sb = new StringBuilder(); StringBuilderUtils.appendEscapingQuotes(sb, "abc"); assertEquals("abc", sb.toString()); }
public static void appendEscapingQuotes(StringBuilder b, String value) { for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); if (c == '"') { b.append('\\'); } b.append(c); } }
StringBuilderUtils { public static void appendEscapingQuotes(StringBuilder b, String value) { for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); if (c == '"') { b.append('\\'); } b.append(c); } } }
StringBuilderUtils { public static void appendEscapingQuotes(StringBuilder b, String value) { for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); if (c == '"') { b.append('\\'); } b.append(c); } } private  StringBuilderUtils(); }
StringBuilderUtils { public static void appendEscapingQuotes(StringBuilder b, String value) { for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); if (c == '"') { b.append('\\'); } b.append(c); } } private  StringBuilderUtils(); static void appendQuotedIfNonToken(StringBuilder b, String value); static void appendQuotedIfWhitespace(StringBuilder b, String value); static void appendQuoted(StringBuilder b, String value); static void appendEscapingQuotes(StringBuilder b, String value); }
StringBuilderUtils { public static void appendEscapingQuotes(StringBuilder b, String value) { for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); if (c == '"') { b.append('\\'); } b.append(c); } } private  StringBuilderUtils(); static void appendQuotedIfNonToken(StringBuilder b, String value); static void appendQuotedIfWhitespace(StringBuilder b, String value); static void appendQuoted(StringBuilder b, String value); static void appendEscapingQuotes(StringBuilder b, String value);  }