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

booleanisBlank(String text)
Whether the String is null, zero-length and does contain only whitespace
if (isEmpty(text))
    return true;
for (int i = 0; i < text.length(); i++) {
    if (!Character.isWhitespace(text.charAt(i)))
        return false;
return true;
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;
booleanisNullOrEmpty(String str)
is Null Or Empty
return str == null || str.trim().length() == 0;
booleanisEmpty(final String value)
Returns true if the string is null or 0-length.
return value == null || value.length() == 0;
BooleanisEmpty(String s)
is Empty
boolean flag;
if (s == null || s.length() == 0)
    flag = true;
else
    flag = false;
return Boolean.valueOf(flag);
booleanisEmpty(String value)
is Empty
return (value == null || value.trim().length() == 0);
booleanisNotEmpty(String value)
is Not Empty
return (!isEmpty(value));
booleanisEmptyOrNull(String string)
is Empty Or Null
if (string == null) {
    return true;
if (string.trim().length() == 0) {
    return true;
return false;
booleanisEmpty(String input)
is Empty
if (input == null || "".equals(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;
booleanisNotEmpty(String s)
is Not Empty
return (s != null && s.trim().length() > 0);