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

String Comparison and return values


  • Subject: String Comparison and return values
  • From: John Ku <email@hidden>
  • Date: Tue, 26 May 2009 00:33:42 -0700

I am currently trying to compare two string to see if they're equal to each
other. The two values should be equal but when debugging it's giving me a
false return. What gives?
NSString *itemA = [DictionaryA valueForKey:@"FirstProcessIdentifier"];
NSWorkspace *workSpace = [NSWorkspace sharedWorkspace];
for (NSDictionary *apps in [workSpace launchedApplications]) {
  if ( [itemA isEqualTo: [apps valueForKey:
@"NSApplicationProcessIdentifier"]] ) {
    NSLog(@"this should run" );
    }
}


the NSString "itemA" should contain for example "312" pid
one of the "[apps valueForKey: @"NSApplicationProcessIdentifier"]" should
also return the same "312"

When I NSLog both, there is a matching set "312", but the if statement is
returning false...any tips?

Thanks,
John
_______________________________________________

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

  • Follow-Ups:
    • Re: String Comparison and return values
      • From: Graham Cox <email@hidden>
  • Prev by Date: Re: warning 'NSEvent' may not respond to '+eventWithEventRef:'
  • Next by Date: Re: String Comparison and return values
  • Previous by thread: Re: warning 'NSEvent' may not respond to '+eventWithEventRef:'
  • Next by thread: Re: String Comparison and return values
  • Index(es):
    • Date
    • Thread