private static String markInString(final String text, final int pos, final String beforeAfter) {
        if (pos <= 0) {
            return beforeAfter + text;
        }
        if (pos >= text.length()) {
            return text + beforeAfter;
        }
        return text.substring(0, pos - 1) + beforeAfter.charAt(0) + text.charAt(pos) + beforeAfter.charAt(1) + text.substring(pos + 1);
    }
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