The list of methods to do String Empty to Null are organized into topic(s).
String
emptyToNull(String s) empty To Null
if (s == null || s.length() == 0)
return null;
String trimmed = trim(s);
return (trimmed.length() != 0 ? s : null);
String
emptyToNull(String s) Converts a 0-length string to null, leaves the string as is otherwise.
if (s == null)
return null;
return s.length() == 0 ? null : s;
String
emptyToNull(String str) Returns the given string if it is nonempty; null otherwise.
return (str == null || str.length() == 0) ? null : str;