code: private static int jsSplitMatch(String stringValue, int startIndex,
                                    String separator) {
  
      if (startIndex + separator.length() > stringValue.length()) {
        return -1;
      }
  
      int matchIndex = stringValue.indexOf(separator, startIndex);
  
      if (matchIndex < 0) {
        return -1;
      }
  
      return matchIndex;
    }
docs: Support function for jsSplit, find the first occurrence of
  separator within stringValue starting at startIndex.