code: public static String trimSubstring(String string, int pos, int limit) {
      int start = skipLeadingAsciiWhitespace(string, pos, limit);
      int end = skipTrailingAsciiWhitespace(string, start, limit);
      return string.substring(start, end);
    }
docs: Equivalent to {@code string.substring(pos, limit).trim()}.