is Blank string - Android java.lang

Android examples for java.lang:String Null or Empty

Description

is Blank string

Demo Code


public class Main{

    public static boolean isBlank(String str) {
        int strLen;
        if (str == null || (strLen = str.length()) == 0) {
            return true;
        }//from   w w w  .ja  va2  s  .c  om
        for (int i = 0; i < strLen; i++) {
            if ((Character.isWhitespace(str.charAt(i)) == false)) {
                return false;
            }
        }
        return true;
    }

}

Related Tutorials