I would like to rearrange an NSMutableArray
in a very particular way. This
1, 7, 0, 45, 0, 0, 500, 0
Would become like this
1, 7, 45, 500, 0, 0, 0, 0
.
Anything that's not 0 (or some special value) should be sorted normally at the beginning, with the 0s at the end. How would I do this?
This is going to be used for deletion of a cell from a table view, my table works so that cell index will always point to element in an array. If I leave a blank space the index would no longer lineup with the array.