• 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: String Comparison and return values
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: String Comparison and return values


  • Subject: Re: String Comparison and return values
  • From: John Ku <email@hidden>
  • Date: Tue, 26 May 2009 01:09:05 -0700

Ahhh, that's a really great tip! Thanks!!Would come in really handy!

On Tue, May 26, 2009 at 1:04 AM, Thomas Davie <email@hidden> wrote:

>
> Op 26 May 2009, om 09:56 heeft John Ku het volgende geschreven:
>
>  Oh so the very first return value from a Dictionary is not actually a
>> string?
>> NSString *itemA = [DictionaryA valueForKey:@"FirstProcessIdentifier"];
>>
>> I've check the apple document, valueForKey returns an ID...  so it return
>> an
>> object? how do I proceed?
>> If i cast it as NSString it gives me an error.
>>
>
> Simple - sort your type error out!  The dictionary contains at least one
> number.  This means that either you're creating it wrong, or you're trying
> to get values out of it wrong...
>
> In the latter case you might want to try something like
>
> id item = [dictionaryA valueForKey:@"FirstProcessIdentifier"];
>
> if ([item isKindOfClass:[NSString class]])
> {
>        // do stuff
> }
> else if ([item isKindOfClass:[NSNumber class]])
> {
>        // do other stuff
> }
> ...
>
>
> Bob
>
_______________________________________________

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

References: 
 >String Comparison and return values (From: John Ku <email@hidden>)
 >Re: String Comparison and return values (From: Graham Cox <email@hidden>)
 >Re: String Comparison and return values (From: John Ku <email@hidden>)
 >Re: String Comparison and return values (From: John Ku <email@hidden>)
 >Re: String Comparison and return values (From: Bill Bumgarner <email@hidden>)
 >Re: String Comparison and return values (From: John Ku <email@hidden>)
 >Re: String Comparison and return values (From: Thomas Davie <email@hidden>)

  • Prev by Date: Re: String Comparison and return values
  • Next by Date: Re: String Comparison and return values
  • Previous by thread: Re: String Comparison and return values
  • Next by thread: Re: String Comparison and return values
  • Index(es):
    • Date
    • Thread