public static int skipContentsUntil(String args, int startIndex, int len, String[] keywords,
            boolean caseSensitive) {
        int k = keywords != null ? keywords.length : 0;
        if (k == 0) {
            return Math.min(startIndex + 1, len);
        }

        int index = skipContentsUntil(args, startIndex, len, keywords[0], caseSensitive);
        for (int j = 1; j < k; j++) {
            String keyword = keywords[j];
            if (keyword == null || keyword.isEmpty()) {
                index++;
            } else {
                int klen = keyword.length();
                if (index + klen >= len) {
                    return len;
                }

                for (int i = index; i < len; i++) {
                    String s = args.substring(i, i + klen);
                    if ((caseSensitive && s.equals(keyword)) || (!caseSensitive && s.equalsIgnoreCase(keyword))) {
                        index = i + klen;
                        break;
                    } else {
                        char ch = args.charAt(i);
                        if ((ch == '-' || ch == '/') && i + 1 < len) {
                            char nextCh = args.charAt(i + 1);
                            if (ch == '-' && nextCh == '-') {
                                i = skipSingleLineComment(args, i + 2, len) - 1;
                            } else if (ch == '/' && nextCh == '*') {
                                i = skipMultiLineComment(args, i + 2, len) - 1;
                            } else {
                                return len;
                            }
                        } else if (!Character.isWhitespace(ch)) {
                            return len;
                        }
                    }
                }
            }
        }

        return index;
    }
Skip quoted string, comments, and brackets until seeing all the given
{@code keywords}(with only whitespaces or comments in between) or reaching
end of the given string.

@param args          non-null string to scan
@param startIndex    start index
@param len           end index, usually length of the given string
@param keywords      keywords, null or empty one means any character
@param caseSensitive whether keyword is case sensitive or not
@return index of {@code endChar} or {@code len}
clickhouse-data/src/main/java/com/clickhouse/data/ClickHouseUtils.java