public int findSplitStart(char[] chars, int split) {
        if (split <= 0) {
            return -1;
        }
        // We expect the chars to start with a split.
        int charNr = 0;
        boolean inSplit = false;
        int currentSplit = 0;
        for (char theChar : chars) {
            if (isEndOfStringSeparator(theChar)) {
                return -1;
            }

            if (isSeparator(theChar)) {
                if (inSplit) {
                    inSplit = false;
                }
            } else {
                if (!inSplit) {
                    inSplit = true;
                    currentSplit++;
                    if (currentSplit == split) {
                        return charNr;
                    }
                }
            }
            charNr++;
        }
        return -1;
    }
Find the start offset of split

@param chars The input in which we are seeking
@param split  The split number for which we are looking for the start
@return The offset or -1 if it does not exist
analyzer/src/main/java/nl/basjes/parse/useragent/utils/Splitter.java