On Jan 6, 2009, at 10:42 AM, Karan, Cem (Civ, ARL/CISD) wrote:
I know I'm being pedantic, but just to make sure, will the following
code work?
// mySortedArray is an NSArray of NSString instances that has been
sorted
// via caseInsensitiveCompare:. [...]
CFRange arrayRange;
arrayRange.location = 0;
arrayRange.length = [mySortedArray count];
CFIndex stringIndex;
stringIndex = CFArrayBSearchValues( mySortedArray,
arrayRange,
myString,
CFStringCompare,
kCFCompareForcedOrdering);
If the array has been sorted with caseInsensitiveCompare:, then you
need to provide string comparison flags to match. You would need
kCFCompareCaseInsensitive|kCFCompareNonliteral. Passing
kCFCompareForcedOrdering when you didn't use NSForcedOrderingSearch
when originally sorting the array seems like asking for trouble, too.
Regards,
Ken
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com