Re: Sorting NSStrings in NSTableColumn (need 10 after 9)
Re: Sorting NSStrings in NSTableColumn (need 10 after 9)
- Subject: Re: Sorting NSStrings in NSTableColumn (need 10 after 9)
- From: Ricky Sharp <email@hidden>
- Date: Fri, 8 Apr 2005 16:03:07 -0500
On Apr 8, 2005, at 2:50 PM, Lee Morgan wrote:
Hey all,
I'm having a problem sorting my NSTableColumn "properly".
It's filled with NSString objects which currently appear like so..
- 1
1
1/2
10
1A
2
However I need them to appear like so (the "proper" way)
- 1
1/2
1
1A
2
10
I'm tried searching the archives, docs, and google but I haven't found
anything on how to correct this. Sorting the "1/2" case isn't that big
of a deal, it can pretty much fall where it falls, but the "1A", and
"2" appearing after "10" is a killer for me.
When comparing your strings, use the NSNumericSearch option
For example, in one of my model's compare: methods, I do this:
- (NSComparisonResult)compare:(IIStudent*)anotherStudent;
{
return [[self studentName] compare:[anotherStudent studentName]
options:NSLiteralSearch | NSNumericSearch | NSCaseInsensitiveSearch];
}
___________________________________________________________
Ricky A. Sharp mailto:email@hidden
Instant Interactive(tm) http://www.instantinteractive.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden