@SuppressWarnings("PMD.NPathComplexity")
    private Object parseUntilInternal(final Predicate<Character> stopper, final boolean endIsDelim, final Character escapeChar, final boolean escapeDoubledStoppers, final boolean includeStopper) {

        if (escapeChar != null && stopper != null && stopper.test(escapeChar)) {
            throw new UnsupportedOperationException("EscapeChar may not be StopChar at same time");
        }

        final StringBuilder sb = new StringBuilder();
        boolean foundEnd = false;
        boolean escape = false;
        char stopChar = (int) 0;
        while (ch != END_CHAR) {
            if (escapeChar != null && ch == escapeChar) {
                if (escape) {
                    sb.append(escapeChar.charValue());
                    escape = false;
                } else {
                    escape = true;
                }
            } else {
                if (stopper != null && stopper.test((char) ch) && !escape) {
                    stopChar = (char) ch;
                    next();
                    if (!escapeDoubledStoppers || !stopper.test((char) ch)) {
                        foundEnd = true;
                        break;
                    }
                    stopChar = (int) 0;
                }
                escape = false;
                sb.append((char) ch);
            }
            next();
        }
        return foundEnd || endIsDelim ? (includeStopper ? new Pair<>(sb.toString(), stopChar) : sb.toString()) : null;
    }
Parses text until a 'stopper' char is reached. Places pos after this stopper char and returns parsed text.
Returns null if no stopper char is found

@param stopper               chars to stop parsing at
@param endIsDelim            if true, then 'end-of-expression' is treated like finding a stopper char
@param escapeChar            if not null, then characters escapced with this char will not be considered stopper chars but parsed as literal char
@param escapeDoubledStoppers if true, then doubled up stopper chars will not be considered stoppers but parsed as single literal chars
main/src/main/java/cgeo/geocaching/utils/TextParser.java