Re: Simple syntax question
- From: Knute Johnson <nospam@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 28 Feb 2008 17:17:01 -0800
somebody wrote:
Is this the best we to conditionally do something if str is NOT equal to
one, two, three, or four, AND mystr is NOT equal to X? I can't seem to
find anything like a str.unequal. I want the if block to execute if str
equals "seven" and mystr equals "Y"
if ( !(str.equals("one")) && !(str.equals("two")) && !(str.equals("three")) && !(str.equals("four")) &&
(mystr.compareTo("X") != 0) )
{
Then do this...
-Thanks
Ugly isn't it? You don't need the parenthesis around the String.equals() to protect the !, you can just write !String.equals().
Also remember that !a && !b == !(a || b).
--
Knute Johnson
email s/nospam/knute/
--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDem
.
- References:
- Simple syntax question
- From: somebody
- Simple syntax question
- Prev by Date: Simple syntax question
- Next by Date: SSL Certificates?
- Previous by thread: Simple syntax question
- Next by thread: Re: Simple syntax question
- Index(es):
Relevant Pages
|
|