O'Reilly logo

Cocoa Programming for OS X: The Big Nerd Ranch Guide by Aaron Hillegass, Adam Preble, Nate Chandler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

For the More Curious: The caseInsensitiveCompare(_:) Method

In the previous section, you specified that the Selector used to sort the Name column should be caseInsensitiveCompare:. The caseInsensitiveCompare: selector corresponds to the method caseInsensitiveCompare(_:) on String. You can use that method programmatically as follows:

l​e​t​ ​m​o​t​o​r​s​i​c​k​l​e​:​ ​S​t​r​i​n​g​ ​=​ ​"​P​i​a​g​g​i​o​"​ l​e​t​ ​m​o​t​o​r​s​i​g​h​:​ ​S​t​r​i​n​g​ ​=​ ​"​I​t​a​l​j​e​t​"​ l​e​t​ ​o​r​d​e​r​:​ ​N​S​C​o​m​p​a​r​i​s​o​n​R​e​s​u​l​t​ ​=​ ​m​o​t​o​r​s​i​c​k​l​e​.​c​a​s​e​I​n​s​e​n​s​i​t​i​v​e​C​o​m​p​a​r​e​(​m​o​t​o​r​s​i​g​h​)​ /​/​ ​W​o​u​l​d​ ​m​o​t​o​r​s​i​c​k​l​e​ ​c​o​m​e​ ​f​i​r​s​t​ ​i​n​ ​t​h​e​ ​d​i​c​t​i​o​n​a​r​y​?​ i​f​ ​o​r​d​e​r​ ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required