- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Can we get another 50 or 60 answers to this question? I'm not sure the horse is quite dead yet.
Admin
Oh, OK. So I guess all Hispanics look alike?
Admin
!"".equals(object) is the same as !(object.equals("")), except that it will not throw a null pointer if object is null;
Admin
Thanks! Just 49 to go!
Admin
Admin
I would say that !"".equals(...) is a pretty 'cool' way to check for an enpty string :-)
Admin
!"".equals() simply means "not equal to an empty string"
Admin
Dude, aspergers don't grow in the desert, and it isn't even the right season for them, anyway.
(Captcha: abigo - you're usually doing something right if there's only one of them and not two to the n of 'em)
Admin
!"".equals() is probably a check that the FieldName with white space removed is not equal to an empty string. The '!' is the NOT operator, the '""' is an empty string, and the 'Trim()' command removes white space.
Admin
Wouldn't that mean "is not an empty string"?
Admin
With regards to the content of your openly combative question, I can't say about all Hispanics, since I haven't met them all yet, but you do look a bit like Jaime to me...
And this guy has a better point.
Admin
It was a yoke, man. A failed joke, too, because that guy isn't even hispanic. Shit.
Admin
Better get this thing recalibrated.
Admin
It's comparing params.get(sub.getFieldName().toLowerCase()).getValue().trim() to an empty value.
Admin
checks if its not empty?
Admin
The ! in C# typically means to flip the boolean of the result, so in this case that would be saying if the statement in the parenthesis is false (.equals, i presume, returns a boolean TRUE or FALSE), then the result should be true.
That said...wow, that's a fugly way of writing something...
Admin
Do'h...just realized the featured comment is getting tons of reply. Kind of a bad BBS system...
Admin
!"".equals(test) - it's a null-safe way of checking whether test is not an empty string.
Admin
Hell, if we call it coding, we'd better make sure the stuff isn't readable, eh?
Admin
!"".equals seems like a really bad way to check for a null string. But then, this is enterprise code.
Admin
It's a very weird way of testing whether the string being fetched by the monstrosity inside the parentheses is empty barring whitespace.
Admin
Combined with the previous line, it's equivalent to
!String.isNullOrEmpty(params.get(sub.getFieldName().toLowerCase()).getValue())
I think
Admin
if the key (in case insensitive / always lower case form) is present, and the value is not a null or empty string.
Man that .NET string.IsNullOrEmpty function would come in handy here.
Also some temporary variables.
Admin
In Java strings, such as "foo" and "bar" are actually objects at some level, so it's perfectly valid to say if ("foo".equals(stringFoo)) (although most people would probably say if (stringFoo.equals("foo"))
Admin
It doesn't test if the string is null - just that it's not empty
Admin
Admin
Yes it checks if the string in empty. Although there is better way to do that.
Admin
!"".equals(...) verifies that the trimmed String is not empty.
That is to say, it's equivalent to the Boolean expression:
!(params.get(sub.getFieldName().toLowerCase()).getValue().trim()).equals("")
Admin
I guess it just checks that the string is not empty...
I have to admit that when checking the presence of "*" in a string, I never thought of ignoring the case they used for it! I have just learned something :)