>>wait.. that's it isnt it? i should just catch it, instead of checking
>>if its null?
>
> you probably want:
>
> if ( cmd.length > 1 && cmd[1] != null && cmd[1].length() > 0 )

Signature
Unemployed English Java programmer
http://jroller.com/page/tackline/
On Sun, 27 Nov 2005 14:16:42 +0000, Thomas Hawtin
<usenet@tackline.plus.com> wrote, quoted or indirectly quoted someone
who said :
>For me str.length() != 0 (or !str.equals("")) is clearer than
>str.length() > 0.
But you don't want negative length strings, even if there were such a
thing. You want something with characters in it.
!str.equals("") implies you are avoiding some particular value.
It seems in general better to specify what you do want than what you
don't. Of course which feels natural then flows from the choice you
made in the deep past. It feels natural because that's your idiomatic
way of doing it.
My choice would originally have been influenced by an understanding of
the implementation. str.length()>0 will compile better code even on a
stupid compiler/runtime.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Thomas Hawtin - 27 Nov 2005 18:40 GMT
> On Sun, 27 Nov 2005 14:16:42 +0000, Thomas Hawtin
> <usenet@tackline.plus.com> wrote, quoted or indirectly quoted someone
[quoted text clipped - 5 lines]
> But you don't want negative length strings, even if there were such a
> thing. You want something with characters in it.
I want to be quite clear that String.length never returns any special
values...
> !str.equals("") implies you are avoiding some particular value.
...and that I am avoiding one particular value of string.
Tom Hawtin

Signature
Unemployed English Java programmer
http://jroller.com/page/tackline/
Mark - 02 Dec 2005 02:38 GMT
well. lee's solution was quite alright.
thank you guys :p