Validate whether target string is null or empty - Android java.lang

Android examples for java.lang:String Null or Empty

Description

Validate whether target string is null or empty

Demo Code

import android.text.Html;

public class Main{

    /**/* w  ww  .j ava 2s .  c o  m*/
     * Validate whether target string is null or empty
     * 
     * @param str
     * @return boolean
     */
    public static boolean isNullOrEmpty(String str) {
        return ((str == null || str.isEmpty()) ? true : false);
    }

}

Related Tutorials