code: public static int delimiterOffset(String input, int pos, int limit, char delimiter) {
      for (int i = pos; i < limit; i++) {
        if (input.charAt(i) == delimiter) return i;
      }
      return limit;
    }
docs: Returns the index of the first character in {@code input} that is {@code delimiter}. Returns
  limit if there is no such character.