public String getSplitRange(String value, int firstSplit, int lastSplit) {
        if (value == null || (lastSplit > 0 && lastSplit < firstSplit)) {
            return null;
        }
        char[] characters = value.toCharArray();
        int firstCharOfFirstSplit = findSplitStart(characters, firstSplit);
        if (firstCharOfFirstSplit == -1) {
            return null;
        }

        if (lastSplit == -1) {
            return value.substring(firstCharOfFirstSplit, findEndOfString(characters, firstCharOfFirstSplit));
        }
        int firstCharOfLastSplit = firstCharOfFirstSplit;
        if (lastSplit != firstSplit) {
            firstCharOfLastSplit = findSplitStart(characters, lastSplit);
            if (firstCharOfLastSplit == -1) {
                return null;
            }
        }

        int lastCharOfLastSplit = findSplitEnd(characters, firstCharOfLastSplit);

        return value.substring(firstCharOfFirstSplit, lastCharOfLastSplit);
    }
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