Re: Newbie: compare version string
Re: Newbie: compare version string
- Subject: Re: Newbie: compare version string
- From: "Adam R. Maxwell" <email@hidden>
- Date: Sun, 9 Dec 2007 13:04:17 -0800
On Dec 9, 2007, at 12:36 PM, Clark Cox wrote:
On Dec 9, 2007 10:39 AM, Adam R. Maxwell <email@hidden> wrote:
On Dec 9, 2007, at 10:27 AM, Clark Cox wrote:
On Dec 9, 2007 7:10 AM, Fritz Anderson <email@hidden>
wrote:
A lexical comparison (-[NSString compare:]) won't work, even
without
fourth versions and stage letters. Consider that 10.4.1 < 10.4.11 <
10.4.2.
No, but
[string1 compare: string2 options: NSNumericSearch]
should work.
At least as of 10.4.3, that didn't work correctly with string
literals, so we use an NSString category method:
- (NSComparisonResult)numericCompare:(NSString *)otherString{
return CFStringCompare((CFStringRef)self,
(CFStringRef)otherString, kCFCompareNumerically);
}
I can't speak to 10.4.3, but I just tried it out on 10.5.1, and it
works as expected:
Cool, looks like it's fixed. The problem I'm thinking of was
described here
http://www.cocoabuilder.com/archive/message/cocoa/2005/12/4/151822
and ISTR verifying that it was a problem for us at the time.
thanks,
adam
_______________________________________________
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