Java Utililty Methods String Empty to Null

List of utility methods to do String Empty to Null

Description

The list of methods to do String Empty to Null are organized into topic(s).

Method

StringemptyToNull(String str)
empty To Null
return isBlank(str) ? null : str;
StringemptyToNull(String str)
empty To Null
return isEmpty(str) ? null : str;
StringemptyToNull(String string)
empty To Null
return isNullOrEmpty(string) ? null : string;
StringemptyToNull(String text)
empty To Null
if (text != null) {
    if (text.trim().isEmpty()) {
        text = null;
return text;
StringemptyToNull(String val)
empty To Null
return emptyToDefault(val, null);
StringemptyToNull(String value)
empty To Null
if (value.length() == 0) {
    return null;
return value;
StringemptyToString(String str, String returnStr)
empty To String
return isNotEmpty(str) ? str : returnStr;
booleanisHtmlNull(String str)
is Html Null
if (isEmpty(str) || "null".equals(str.toLowerCase().trim())) {
    return true;
return false;
StringnullSafeToString(Object obj)
Convert the supplied Object to a String using the following algorithm.
if (obj == null) {
    return "null";
} else if (obj.getClass().isArray()) {
    if (obj.getClass().getComponentType().isPrimitive()) {
        if (obj instanceof boolean[]) {
            return Arrays.toString((boolean[]) obj);
        if (obj instanceof char[]) {
...
StringnvlStr(Object o, String valueIfNull)
nvl Str
if (isEmpty(o)) {
    return valueIfNull;
return o.toString();