code: public static String trimAllWhitespace(final String str) {
      if (!StringUtils.hasLength(str)) {
        return str;
      }
  
      final int len = str.length();
      final StringBuilder sb = new StringBuilder(str.length());
      for (int i = 0; i < len; i++) {
        final char c = str.charAt(i);
        if (!Character.isWhitespace(c)) {
          sb.append(c);
        }
      }
      return sb.toString();
    }
docs: Trim <i>all</i> whitespace from the given {@code String}: leading, trailing, and in between
  characters.
  
  @param str the {@code String} to check
  @return the trimmed {@code String}
  @see java.lang.Character#isWhitespace