본문 바로가기
웹프로그래밍/Java

"" 로 들어 왔는데 체크하는방법

by Seras 2017. 10. 31.
반응형

"" 로 들어 왔는데 체크하는방법



if( == null && StringUtils.isEmpty()){

}





 // Empty checks

    //-----------------------------------------------------------------------

    /**

     * <p>Checks if a String is empty ("") or null.</p>

     *

     * <pre>

     * StringUtils.isEmpty(null)      = true

     * StringUtils.isEmpty("")        = true

     * StringUtils.isEmpty(" ")       = false

     * StringUtils.isEmpty("bob")     = false

     * StringUtils.isEmpty("  bob  ") = false

     * </pre>

     *

     * <p>NOTE: This method changed in Lang version 2.0.

     * It no longer trims the String.

     * That functionality is available in isBlank().</p>

     *

     * @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;

    }

반응형