docs: public static String trim(String value) {
      int start;
      int end;
      final int lengthMinusOne = value.length() - 1;
      for (start = 0; start <= lengthMinusOne; ++start) {
        if (!isSpace(value.charAt(start))) {
          break;
        }
      }
      for (end = lengthMinusOne; end >= start; --end) {
        if (!isSpace(value.charAt(end))) {
          break;
        }
      }
      if (start == 0 && end == lengthMinusOne) {
        return value;
      }
      if (start > lengthMinusOne) {
        return "";
      }
      return value.substring(start, end + 1);
    }