• 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: Is this a bug of the Cocoa or the Objective-C?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is this a bug of the Cocoa or the Objective-C?


  • Subject: Re: Is this a bug of the Cocoa or the Objective-C?
  • From: Jérome Laurens <email@hidden>
  • Date: Fri, 26 Jan 2007 14:02:10 +0100


Le 26 janv. 07 à 05:58, JongAm Park a écrit :
Hello,

I have a strange problem.
Here is the code that shows the problem.

while( item = [objectsEnumerator nextObject] ) {

keyString = [item valueForKeyPath:@"CF_EncodingName"];

theRange = [keyString rangeOfString:searchString options:NSLiteralSearch];


   if( theRange.location != NSNotFound ){
	[filteredObjects addObject:item];
    }
}


you'd better test for theRange.length>0

That way, if keyString is nil, theRange.length is 0, as explained by Nick Zitzmann, and you test is consistent




_______________________________________________

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


  • Follow-Ups:
    • Re: Is this a bug of the Cocoa or the Objective-C?
      • From: Jim Correia <email@hidden>
References: 
 >Is this a bug of the Cocoa or the Objective-C? (From: JongAm Park <email@hidden>)

  • Prev by Date: Re: Color Table Animation
  • Next by Date: Tooltip support broken for NSTableView on 10.4?
  • Previous by thread: Re: Is this a bug of the Cocoa or the Objective-C?
  • Next by thread: Re: Is this a bug of the Cocoa or the Objective-C?
  • Index(es):
    • Date
    • Thread