Java Utililty Methods Null Value Convert

List of utility methods to do Null Value Convert

Description

The list of methods to do Null Value Convert are organized into topic(s).

Method

StringconvertNull(Object o)
convert Null
try {
    String strvalue = String.valueOf(o);
    if (strvalue.equals(null) || strvalue.equals("null") || strvalue.length() == 0) {
        return "";
    } else {
        return strvalue.trim();
} catch (Exception e) {
...
StringconvertNull(Object source)
Returns the string representation of a given object or an empty string if the object is null.
return convertNull(source, "");
StringconvertNull2ZeroString(String value)
convert Null Zero String
if (value == null) {
    return "";
} else {
    return value;
StringconvertNullableString(Object object)
convert Nullable String
if (object == null) {
    return new String();
return object.toString();
StringconvertNullString2Empty(Object str)
Return empty string if the input string is null
if (str == null)
    return "";
else
    return str.toString();
StringconvertNullToBlank(String s)
convert Null To Blank
return null == s ? "" : s;
StringconvertNullToEmptyStr(String inObj)
convert Null To Empty Str
if (inObj == null) {
    return "";
return inObj;
StringconvertNullToEmptyString(Object raw)
Converts null to empty string
return raw == null ? "" : String.valueOf(raw);
StringconvertNullToEmptyString(String s)
Returns the empty string if s is null; otherwise, returns s.
return (s == null) ? "" : s;
StringconvertNullToEmptyString(String value)
Converts value to a empty string if value is null.
if (value == null) {
    return "";
return value;