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

Stringnull2Length0(String s)
null Length
return s == null ? "" : s;
Stringnull2NA(String str)
null NA
return null != str ? str : "NA";
StringNull2Space(String str)
Null Space
if (str == null)
    return "";
else if (str.equals("null") || str.equals("NULL"))
    return "";
else
    return str;
Stringnull2Str(Object obj)
null Str
if ((obj == null) || (obj.equals("null")) || (obj.equals(""))) {
    return "";
} else {
    return obj.toString().trim();
Stringnull2Str(String str)
null Str
return null2Str(str, "");
Stringnull2String(Object obj)
Converts null to empty string, otherwise returns it directly.
return obj == null ? "" : obj.toString();
Stringnull2String(String str)
null String
String str2 = new String();
if (str == null) {
    str2 = "";
} else {
    str2 = str;
return str2;
Stringnull2String(String string)
null String
return string == null ? "" : string;
Stringnull2void(String str)
nullvoid
if (isNull(str)) {
    str = "";
return str;