public static boolean containsCommaSep(Object base, long offset, int len, byte[] sub) {
        assert sub != null && sub.length > 0;

        long start = 0, lastBlankStart = -1;
        // 0: searching for next sub string
        // 1: recording sub string
        byte state = 0;

        long i = offset;
        for (; i < offset + len; i++) {
            byte b = Platform.getByte(base, i);
            switch (state) {
                case 0:
                    switch (b) {
                        case ' ':
                            break;
                        case ',':
                            break;
                        default:
                            start = i;
                            state = 1;
                            lastBlankStart = -1;
                            break;
                    }
                    break;
                case 1:
                    switch (b) {
                        case ' ':
                            if (lastBlankStart == -1) {
                                lastBlankStart = i;
                            }
                            break;
                        case ',':
                            // check equals here.
                            long end = lastBlankStart == -1 ? i : lastBlankStart;
                            if (end - start == sub.length
                                    && ByteArrayMethods.arrayEquals(
                                    base, start,
                                    sub, Platform.BYTE_ARRAY_OFFSET, sub.length)) {
                                return true;
                            }
                            start = 0;
                            state = 0;
                            break;
                        default:
                            // found a charactor which is not blank, reset black state.
                            lastBlankStart = -1;
                            break;
                    }
                default:
                    // Kidding me?
            }
        }
        if (state == 1) {
            long end = lastBlankStart == -1 ? i : lastBlankStart;
            if (end - start == sub.length
                    && ByteArrayMethods.arrayEquals(
                    base, start,
                    sub, Platform.BYTE_ARRAY_OFFSET, sub.length)) {
                return true;
            }
        }
        return false;
    }
First split the utf-8 string by comma and trim blanks, then check whether they contains the sub string.
indexr-common/src/main/java/io/indexr/util/UTF8Util.java