is String Empty - Java java.lang

Java examples for java.lang:String Null Or Empty

Description

is String Empty

Demo Code


public class Main{

    public static void main(String[] argv){
        String string = "java2s.com";
        System.out.println(isEmpty(string));
    }//  w w  w .  j  a  va 2 s.  c  o  m
    public static boolean isEmpty(String string) {
        return string == null || string.trim().length() == 0;
    }

}

Related Tutorials