void (StringBuilder builder, String toUnescape, boolean isMultiLine) { for (int i = 0; i < builder.length(); i++) { if (builder.charAt(i) != '\\') continue; if (i + 1 == builder.length()) break; char next = builder.charAt(i + 1); if (next == 'n') { if (isMultiLine) { builder.replace(i, i + 2, "\n"); } } else if (next == 'r') { if (isMultiLine) { builder.replace(i, i + 2, "\r"); } } else if (toUnescape.indexOf(next) != -1) { builder.delete(i, i + 1); } else { i++; } } }