List of utility methods to do String Null Convert
String | toNonNull(String str) to Non Null return str == null ? "" : str; |
String | toStrNotNull(Object obj, String defaultStr) to Str Not Null String s = (obj == null) ? defaultStr : obj.toString();
return s;
|
String | convertToNull(String chaine) convert To Null if ("".equals(chaine) || " ".equals(chaine) || "null".equals(chaine) || "NULL".equals(chaine) || "Null".equals(chaine)) { return null; return chaine; |
String | defaultIfNull(String str) default If Null return defaultIfNull(str, EMPTY);
|
String | defaultIfNull(String str, String defaultStr) default If Null return str == null ? defaultStr : str;
|
String | defaultIfBlank(String str, String defaultStr) default If Blank return isBlank(str) ? defaultStr : str;
|
String | defaultIfBlank(String str) default If Blank return defaultIfBlank(str, EMPTY);
|
boolean | isEmptyOrWhitespaceOnly(String str) is Empty Or Whitespace Only if (TextUtils.isEmpty(str)) { return true; for (int i = 0; i < str.length(); i++) { if (!Character.isWhitespace(str.charAt(i))) { return false; return true; |
String | toStringWhenNull(Object src, String newValue) to String When Null if (src == null) { return newValue; String srcStr = src.toString(); if (srcStr == null) { return newValue; return srcStr; ... |
String | toStringWhenNullOrEmpty(Object src, String newValue) to String When Null Or Empty if (src == null) { return newValue; String srcStr = src.toString(); if ((srcStr == null) || (srcStr.equals(""))) { return newValue; return srcStr; ... |