I've got an array of objects, and I need to sort them according to your "title" key. It is currently working, although it is using titanium file names rather than any type of ASCII type, so they will look like this:
file1
2
file3
file10
file11
file12
I am getting, as you would expect:
file1
file10
File11
file12
file3
...
Does anyone know whether to achieve this type of natural ordering in the functionality of NASRARA sorting Is the built-in method as the underlying type? I have found some common algorithms, but I created something in ...
One version:. NSInteger Type (Obj * A, Obj * b, Zero *) {return [[Title] [compare]: [B header] Option: NSNumeric Search]; } Results = [Array Sorted Array Usage Function: & amp; Sort context: zero]; to expect NSString can be done using the Comparison option
Or slightly more general:
NSInteger sort (ID A, ID B, Zero * P) {return [[a valueForKey: (NSString *) P] Comparison: [B valueForKey: (NSString *) P] Option: NSNumericSearch]; } Result = [array array ordering functioning & amp; Sorting references: @ "title"]
or using blocks:
result = [array sorting incapator: ^ (Obj * a, Obj * b) {return [[title] compare: [b header] option: nsnumeric search]; }];
Comments
Post a Comment