code: public static String trimAndNullIfEmpty(final String text) {
          if (text != null && !text.trim().isEmpty()) {
              return text.trim();
          }
          return null;
      }
docs: Trims the text and converts into null in case of an empty string.
  
  @param text
  text to be trimmed
  @return null if the text is null or if the text is blank, text.trim() if
  the text is not empty.