Android String Empty Check isBlank(String text)

Here you can find the source of isBlank(String text)

Description

Whether the String is null, zero-length and does contain only whitespace

Declaration

public static boolean isBlank(String text) 

Method Source Code

//package com.java2s;
import android.text.TextUtils;

public class Main {
    /**/*from  w ww . j ava2 s  .  c  o  m*/
     * Whether the String is null, zero-length and does contain only whitespace
     */
    public static boolean isBlank(String text) {
        if (isEmpty(text))
            return true;
        for (int i = 0; i < text.length(); i++) {
            if (!Character.isWhitespace(text.charAt(i)))
                return false;
        }
        return true;
    }

    /**
     * Whether the given string is null or zero-length
     */
    public static boolean isEmpty(String text) {
        return TextUtils.isEmpty(text);
    }
}

Related

  1. isBlank(EditText editText)
  2. isBlank(String string)
  3. isBlank(String str)
  4. isBlank(String str)
  5. isNotBlank(String str)
  6. isEmpty(String input)
  7. isNullOrEmpty(String str)
  8. isEmpty(final String value)
  9. isEmpty(String s)