How to remove object at all index except first index in NSMutableArray IOS

ios, nsmutablearray, objective-c

Solution

NSMutableArray *testArray=[[NSMutableArray alloc] initWithObjects:@"A",@"B",@"C", nil];
[testArray removeObjectsInRange:NSMakeRange(1, testArray.count-1)];

But please make sure array count is greater than 1.

Problem

I have 1 mutablearray, i want to remove object all indexs but hold object at first index. EXample : Input : Array (a,b,c,d,e) Output: Array (a) Can you help me. Thanks in advance

Original source