• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Empty and null strings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >Empty and null strings (From: Miguel Arroz <email@hidden>)
 >Re: Empty and null strings (From: Chuck Hill <email@hidden>)
 >Re: Empty and null strings (From: Arturo Perez <email@hidden>)

  • Prev by Date: Re: Empty and null strings
  • Next by Date: Re: Getting page variables after the session has been terminated.
  • Previous by thread: Re: Empty and null strings
  • Next by thread: API Documentation
  • Index(es):
    • Date
    • Thread