How can I sort an NSTableColumn of NSStrings ignoring "The " and "A "?

Posted by David Barry on Stack Overflow See other posts from Stack Overflow or by David Barry
Published on 2010-05-09T04:11:42Z Indexed on 2010/05/09 4:18 UTC
Read the original article Hit count: 321

I've got a simple Core Data application that I'm working on to display my movie collection. I'm using an NSTableView, with it's columns bound to attributes of my Core Data store through an NSArrayController object. At this point the columns sort fine(for numeric values) when the column headers are clicked on.

The issue I'm having is with the String sorting, they sort, however it's done in standard string fashion, with Uppercase letters preceding lowercase(i.e. Z before a). In addition to getting the case sorting to work properly, I would like to be able to ignore a prefix of "The " or "A " when sorting the strings.

What is the best way to go about this in Objective-C/Cocoa?

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about objective-c