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 10:39:11 -0800
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);
}
--
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