package com.andyadc.scaffold.util;

/**
 * A string utility class that manipulates string.
 *
 * @author andaicheng
 */
public class StringUtil {

    /**
     * <p>Checks if a String is empty ("") or null.</p>
     * <p>
     * <pre>
     * StringUtil.isEmpty(null)      = true
     * StringUtil.isEmpty("")        = true
     * StringUtil.isEmpty(" ")       = false
     * StringUtil.isEmpty("bob")     = false
     * StringUtil.isEmpty("  bob  ") = false
     * </pre>
     *
     * @param str the String to check, may be null
     * @return <code>true</code> if the String is empty or null
     */
    public static boolean isEmpty(String str) {
        return str == null || str.length() == 0;
    }

    public static boolean isNotEmpty(String str) {
        return !isEmpty(str);
    }

    /**
     * <p>Checks if a String is whitespace, empty ("") or null.</p>
     * <p>
     * <pre>
     * StringUtil.isBlank(null)      = true
     * StringUtil.isBlank("")        = true
     * StringUtil.isBlank(" ")       = true
     * StringUtil.isBlank("bob")     = false
     * StringUtil.isBlank("  bob  ") = false
     * </pre>
     *
     * @param str the String to check, may be null
     * @return <code>true</code> if the String is null, empty or whitespace
     */
    public static boolean isBlank(String str) {
        int strLen;
        if (str == null || (strLen = str.length()) == 0) {
            return true;
        }
        for (int i = 0; i < strLen; i++) {
            if (!Character.isWhitespace(str.charAt(i))) {
                return false;
            }
        }
        return true;
    }

    public static boolean isNotBlank(String str) {
        return !isBlank(str);
    }
}

@@ -109,16 +109,44 @@
 aicheng%0A
+ * @version 1.0, 2016-10-07%0A
  */%0Apubl
@@ -1725,10 +1725,1498 @@
 ;%0A    %7D%0A
+%0A    /**%0A     * Checks if some strings has any blank string.%3Cbr%3E%0A     * If strings == null, return true%0A     *%0A     * @param strings%0A     * @return true if any string is blank, otherwise false.%0A     */%0A    public static boolean isAnyBlank(String... strings) %7B%0A        if (strings == null) %7B%0A            return true;%0A        %7D%0A        for (String s : strings) %7B%0A            if (isBlank(s)) %7B%0A                return true;%0A            %7D%0A        %7D%0A        return false;%0A    %7D%0A%0A    /**%0A     * Checks if all the strings is not blank.%0A     *%0A     * @param strings%0A     * @return true if all string is not blank, otherwise false.%0A     */%0A    public static boolean isAllNotBlank(String... strings) %7B%0A        return !isAnyBlank(strings);%0A    %7D%0A%0A    /**%0A     * %3Cp%3E%0A     * Checks if some strings has any empty string.%0A     * %3C/p%3E%0A     * If strings == null, return true%0A     *%0A     * @param strings%0A     * @return true is any string is empty, otherwise false.%0A     */%0A    public static boolean isAnyEmpty(String... strings) %7B%0A        if (strings == null) %7B%0A            return true;%0A        %7D%0A        for (String s : strings) %7B%0A            if (isEmpty(s)) %7B%0A                return true;%0A            %7D%0A        %7D%0A        return false;%0A    %7D%0A%0A    /**%0A     * Checks if all the strings is not empty.%0A     *%0A     * @param strings%0A     * @return true if all string is not empty, otherwise false.%0A     */%0A    public static boolean isAllNotEmpty(String... strings) %7B%0A        return !isAnyEmpty(strings);%0A    %7D%0A%0A
 %7D%0A

add method for StringUtil