Re: String Comparison and return values
Re: String Comparison and return values
- Subject: Re: String Comparison and return values
- From: Shawn Erickson <email@hidden>
- Date: Tue, 26 May 2009 10:55:12 -0700
On Tue, May 26, 2009 at 9:56 AM, Kirk Kerekes <email@hidden> wrote:
> Consider the pattern:
>
> [[thing description] isEqualToString: someString];
>
> All objects will return a string for description. Whether it is meaningful
> in your terms is a whole other issue.
>
> NSNumber will return a sensible numeric string.
> NSString will return itself.
>
> Generally, property-list objects (other than NSData) will return something
> generically useful in response to -description.
You really shouldn't use the string from -[NSObject description] for
anything other then logging or via the debugger.
You should instead use a common form/representation when doing
comparisons across objects of different classes.
-Shawn
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden