Android Utililty Methods String Empty Check

List of utility methods to do String Empty Check

Description

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

Method

StringtrimToEmpty(String str)
trim To Empty
return isBlank(str) ? EMPTY : trim(str);
booleanisEmpty(String string)
is Empty
if (string == null || string.trim().equals("")) {
    return true;
} else {
    return false;
booleanisEmptyString(String str)
is Empty String
return str == null || str.trim().equals("");
booleanisEmptyString(String str)
is Empty String
if (str == null || str.equals("")) {
    return true;
return false;
booleanisNullOrEmpty(CharSequence any)
CHeck to see if any is either null or empty
return (any == null || any.length() == 0);
booleanisNullOrEmpty(String s)
is Null Or Empty
return s == null || s.length() == 0;
booleanemptyOrNull(String str)
empty Or Null
return str == null || str.length() == 0;
booleanemptyOrNull(String... arrStr)
empty Or Null
for (String str : arrStr) {
    if (emptyOrNull(str)) {
        return true;
return false;
booleanisBlank(String str)
is Blank
return str == null || str.trim().length() == 0;
booleanisEmpty(String input)
is Empty
if (input == null || "".equals(input))
    return true;
for (int i = 0; i < input.length(); i++) {
    char c = input.charAt(i);
    if (c != ' ' && c != '\t' && c != '\r' && c != '\n') {
        return false;
return true;