>>> rohit <[EMAIL PROTECTED]> 03-Jun-00 2:24:14 PM >>>

This is not really on-topic but does have ramifications for what
we're all talking about so...

>Brad, I disagree with you. I don't think writing empty string as ""
or " "
>makes any difference. As for the problem, I can only say after
looking at
>the code.

Empty java.lang.String==""

You can tell that because "".length()==0

Whereas: " ".length()==1 (the space)

But that probably shouldn't affect the code as long as you are
comparing like with like,
ie:
    " ".equals(" ");
or
   "".equals("");

With the empty string you can always do:

  "".length()==0

which is probably more efficient (because the compiler can inline the
call to length()).

IMHO in Java generally you should always use a null guard with
Strings, eg:

 if(string!=null && string.length()!=0)
 //it's not a null or empty string



Nic Ferrier

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to