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: Buddy Kurz <email@hidden>
- Date: Tue, 15 May 2007 06:10:56 -0700
How about prepending some other character when the key is stored and
removing it when reading the key to get the string
NSString * myKey = [NSString stringWithFormat:@"-%@",userString];
NSString * userString = [myKey stringFromIndex:1];
On May 14, 2007, at 10:30 PM, Joe Goh wrote:
On 5/15/07, Sam Stigler <email@hidden> wrote:
Is there an escape character for "@"?
Escaping the character is irrelevant in this case because the @
character is already inside the NSString and NSDictionary valueForKey:
is explicitly checking for this character to invoke [super
valueForKey:] instead of objectForKey:
I could of course make this all work by just stripping the @ character
from the NSString, but as this is input from the user, its much better
to preserve it.
Nice try though Sam,
Regards,
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:
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