Re: Empty and null strings
Re: Empty and null strings
- Subject: Re: Empty and null strings
- From: Chuck Hill <email@hidden>
- Date: Mon, 12 Sep 2005 11:18:50 -0700
Well, what we _actually_ did was to write this into our validation
framework so that string.trim ().length() == 0 and string == null are
validated the same. You could also get EOGenerator to generate the
EOs for you such that String attributes were generated as
public setFoo(String value) {
takeStoredValueForKey(value == null ? null : value.trim(), "foo");
}
Chuck
On Sep 12, 2005, at 11:13 AM, Arturo Perez wrote:
Chuck Hill wrote:
On Sep 9, 2005, at 3:48 PM, Miguel Arroz wrote:
Hi!
This must be a "most asked" question, but here goes... I'm a
little confused with empty and null strings, in what relates to
WOTextField component.
Why does a WOTextField value is null when there is no text?
Shouldn't it be an empty string?
No, I think it should be null. The more interesting question is,
"What is the value if only a space is typed into the field.". In
most cases, I would want to treat this the same as null. IIRC, it
is not null so you have to handle this case specially (e.g.
string.trim ().length() == 0).
So, to handle this properly, one must override every WOComponent's
takeValuesFromRequest() to do the above, correct? My interest lies
more along the lines of
string = string.trim();
-arturo
--
Practical WebObjects - a book for intermediate WebObjects developers
who want to increase their overall knowledge of WebObjects, or those
who are trying to solve specific application development problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden