code: @Nonnull
      public static String trimToEmpty(@Nullable String str) {
          if (str == null) {
              return "";
          } else {
              return str.trim();
          }
      }
docs: if the given string is {@code null}, return {@code ""}, else return {@link String#trim()}.
  
  @param str the string to trim
  @return the trimmed string