• 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: NSDictionary valueForKey: and @ character at start of NSString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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:55:38 +1000

I think I see what you mean... what if you try hashing the string that the user passed into some other string that NSDictionary will like? Maybe by implementing your hash function as a two-way NSValueTransformer? The hash function just has to come up with strings that will be unique... I just checked, and there actually is a [NSString hash] method that returns an int, but I'm not sure if it fulfills the uniqueness requirement.


-Sam http://www.stigler.org/sam/wordpress


On May 15, 2007, at 3: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


References: 
 >NSDictionary valueForKey: and @ character at start of NSString (From: "Joe Goh" <email@hidden>)
 >Re: NSDictionary valueForKey: and @ character at start of NSString (From: Sam Stigler <email@hidden>)
 >Re: NSDictionary valueForKey: and @ character at start of NSString (From: "Joe Goh" <email@hidden>)

  • Prev by Date: Re: NSDictionary valueForKey: and @ character at start of NSString
  • Next by Date: Re: Unique items in Core Data models
  • Previous by thread: Re: NSDictionary valueForKey: and @ character at start of NSString
  • Next by thread: Re: NSDictionary valueForKey: and @ character at start of NSString
  • Index(es):
    • Date
    • Thread