Followers

Wednesday, August 22, 2012

IPhone & J2ME APPLICATION DEVELOPER: Iphone Numeric sorting

IPhone & J2ME APPLICATION DEVELOPER: Iphone Numeric sorting

Iphone Numeric sorting

Iphone Numeric sorting For Array objects

NSArray *unsortedArray = [NSArray arrayWithObjects:@"Hello", @"4", @"Hi", @"5", @"2", @"10", @"1", nil];
NSArray *sortedArray = [unsortedArray sortedArrayUsingComparator:^(id firstObject, id secondObject) {
   
return [((NSString *)firstObject) compare:((NSString *)secondObject) options:NSNumericSearch];
}];


Iphone Numeric sorting string For Array objects