code: public static String trim(final String str) {
          return N.isNullOrEmpty(str) || (str.charAt(0) != ' ' && str.charAt(str.length() - 1) != ' ') ? str : str.trim();
      }
docs: <p>
  Removes control characters (char &lt;= 32) from both ends of this String,
  handling {@code null} by returning {@code null}.
  </p>
  
  <p>
  The String is trimmed using {@link String#trim()}. Trim removes start and
  end characters &lt;= 32. To strip whitespace use {@link #strip(String)}.
  </p>
  
  <p>
  To trim your choice of characters, use the {@link #strip(String, String)}
  methods.
  </p>
  
  <pre>
  StrUtil.trim(null)          = null
  StrUtil.trim("")            = ""
  StrUtil.trim("     ")       = ""
  StrUtil.trim("abc")         = "abc"
  StrUtil.trim("    abc    ") = "abc"
  </pre>
  
  @param str
  the String to be trimmed, may be null
  @return the trimmed string, {@code null} if null String input