jetbrick-commons/src/main/java/jetbrick/lang/StringUtils.java
public static String trimToNull(final String s) {
        final String ts = trim(s);
        return ts == null || ts.length() == 0 ? null : ts;
    }
public static String trimToNull(final String s) {
        final String ts = trim(s);
        return ts == null || ts.length() == 0 ? null : ts;
    }
public static String trimToNull ( final String s ) { final String ts = trim ( s ) ; return ts == null || ts . length ( ) == 0 ? null : ts ; }
<p>
Removes control characters (char &lt;= 32) from both ends of this String
returning {@code null} if the String is empty ("") after the trim or if
it is {@code null}.

<p>
The String is trimmed using {@link String#trim()}. Trim removes start and
end characters &lt;= 32.
</p>

<pre>
StringUtils.trimToNull(null)          = null
StringUtils.trimToNull("")            = null
StringUtils.trimToNull("     ")       = null
StringUtils.trimToNull("abc")         = "abc"
StringUtils.trimToNull("    abc    ") = "abc"
</pre>
<p > Removes control characters ( char &lt ; = 32 ) from both ends of this String returning { @code null } if the String is empty ( ) after the trim or if it is { @code null } .