Re: Abba madness compare:options:range:
Re: Abba madness compare:options:range:
- Subject: Re: Abba madness compare:options:range:
- From: Pete Yandell <email@hidden>
- Date: Tue, 16 Sep 2003 10:55:18 +1000
On Tuesday, September 16, 2003, at 09:25 AM, Jacob Engstrand wrote:
>
This call returns NSOrderedSame
>
>
[@"Abba" compare: @"abba"
>
options: NSCaseInsensitiveSearch
>
range: NSMakeRange(0, 4)];
>
>
>
But this call returns NSOrderedDescending
>
>
[@"Abba" compare: @"abba"
>
options: NSCaseInsensitiveSearch
>
range: NSMakeRange(0, 3)];
>
>
>
As I understand it, the first call compares "Abba" and "abba"
>
disregarding case and so it regards them as being equal. Fine.
>
>
The second call compares "Abb" and "abb" disregarding case and yet it
>
returns saying they are not equal.
From the docs got compare:options:range:locale:
...Returns NSOrderedAscending if the substring of the receiver given by
range precedes aString in lexical ordering...
So you're actually comparing "Abb" to "abba" in the second call.
Pete Yandell
http://pete.yandell.com/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.