Re: NSDictionary valueForKey: and @ character at start of NSString
Re: NSDictionary valueForKey: and @ character at start of NSString
- Subject: Re: NSDictionary valueForKey: and @ character at start of NSString
- From: Sam Stigler <email@hidden>
- Date: Tue, 15 May 2007 15:10:32 +1000
Is there an escape character for "@"?
-Sam
http://www.stigler.org/sam/wordpress
On May 15, 2007, at 2:48 PM, Joe Goh wrote:
Hi everyone,
According to the NSDictionary docs for valueForKey: , it says,
"If key does not start with "@", invokes objectForKey:.
If key does start with "@", strips the "@" and invokes [super
valueForKey:] with the rest of the key."
For my app, I need to handle NSString's (sent by the user) with the @
character at its start.
To work around this issue, i've implemented a category on NSDictionary
that simply calls objectForKey: when valueForKey: is invoked.
Is this dangerous? Will I break anything used by Cocoa internally if
I do this? What's the rationale behind this behaviour for
valueForKey: in the first place?
Thanks!
Joe Goh
FunkeeMonk Technology
http://www.funkeemonk.com/
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
40mac.com
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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