Posted By

mhoeller on 06/22/11


cocoa sorting

Versions (?)

NSSortDescriptor to sort strings with numbers numerically

 / Published in: Objective C

  1. [NSSortDescriptor sortDescriptorWithKey:@"name"
  2. ascending:YES
  3. selector:@selector(localizedStandardCompare:)]

Report this snippet  


RSS Icon Subscribe to comments
Posted By: mhoeller on June 22, 2011

Use this to sort strings like "test 1", "test 2", "test 10", "test 11" so that the result is numerically correct.

You need to login to post a comment.