There are three types of empty string, null, "" and " ". Here is how to check for each flavour:
if ( s == null ) echo ( "was null" );
else if ( s.length() == 0 ) echo ( "was empty" );
else if ( s.trim().length () == 0 ) echo ( "was blank or other whitespace" );
We cant use the following
String s="";
if(s.equals(""))
sop("string equal");
No comments:
Post a Comment