is String Not Empty - Java java.lang

Java examples for java.lang:String Null Or Empty

Description

is String Not Empty

Demo Code

import java.util.regex.Pattern;

public class Main{

    public static void main(String[] argv){
        String string = "java2s.com";
        System.out.println(isNotEmpty(string));
    }/*from   w ww .  j  a  va 2s .  co  m*/
    public static boolean isNotEmpty(String string) {
        return string != null && string.trim().length() > 0;
    }

}

Related Tutorials