String (@NotNull String s, boolean escapeStartQuote, boolean escapeEndQuote, boolean escapeSpacesInTheEnd) { int i = 0; int length = s.length(); StringBuilder result = new StringBuilder(length); while (i < length) { int nextIdx = parseQuotes(i, s, result, escapeStartQuote, escapeEndQuote); if (nextIdx != -1) { i = nextIdx; continue; } nextIdx = parseSpaces(i, s, result, escapeSpacesInTheEnd); if (nextIdx != -1) { i = nextIdx; continue; } nextIdx = parseBackSlashes(i, s, result); if (nextIdx != -1) { i = nextIdx; continue; } result.append(s.charAt(i)); i++; } return result.toString(); }