void (@NotNull StringBuilder buf, @NotNull String str, char unescapeChar) { int length = str.length(); int last = length - 1; for (int i = 0; i < length; i++) { char ch = str.charAt(i); if (ch == '\\' && i != last) { //noinspection AssignmentToForLoopParameter i++; ch = str.charAt(i); if (ch != unescapeChar) buf.append('\\'); } buf.append(ch); } }