Wednesday, 21 August 2013

Removing negative numbers from NSArray in Objective C

Removing negative numbers from NSArray in Objective C

I am new to Objective C. In my application, I am having array of data, in
which I need only positive numbers and need to delete negative numbers.
Result = [NSMutableArray arrayWithObjects:
@"1",@"2",@"3","-4","-5","6","9",nil];
NSLog(@" Before Remove %d", [Result count]);
NSString *nullStr = @"-";
[Result removeObject:nullStr];
How to achieve this? Any pointers?

No comments:

Post a Comment