This is my simplified NSMutableArray from a JSON parsing:
{
main
{
array0,
array1,
array2,
array3, <----- remove!
array4, <----- remove!
array5,
array6, <----- remove!
array7, <----- remove!
array8,
...,
}
}
Im looking the best way to REMOVE SINGLE array items ALTERNATIVELY, example only arrays 2,4,6,8; Also, if I need to remove COUPLES of array 3,4 and 6,7, always alternatively?
EDIT: this is the first solution, to remove SINGLE items alternatively:
for (int i=0; i < [array count]; i = i+1) {
[array removeObjectAtIndex:i];
}
To me it sounds like you could easily create an index set of all the indexes to remove and remove the objects at those indexes using
removeObjectsAtIndexes:.You can get the indexes of all the even (or odd) indexed objects from
indexesOfObjectsPassingTest:.