private String readQuotedString() {
        skip(); // skip start quote

        final int start = this.cursor;
        while (hasNext() && !isQuoteCharacter(peek())) {
            skip();
        }
        final int end = this.cursor;

        if (hasNext()) {
            skip(); // skip end quote
        }
        if (hasNext() && isWhitespace(peek())) {
            skip(); // skip whitespace
        }

        return this.string.substring(start, end);
    }
Tokenizes strings on whitespace, but ignoring whitespace enclosed within quotes.
common/src/main/java/me/lucko/luckperms/common/command/utils/QuotedStringTokenizer.java