[iphone] NSArray + remove item from array

This category may be to your taste. But! Be frugal with its usage; since we are converting to a NSMutableArray and back again, it's not at all efficient.

@implementation NSArray (mxcl)

- (NSArray *)arrayByRemovingObject:(id)obj
{
    if (!obj) return [self copy]; // copy because all array* methods return new arrays
    NSMutableArray *mutableArray = [NSMutableArray arrayWithArray:self];
    [mutableArray removeObject:obj];
    return [NSArray arrayWithArray:mutableArray];
}

@end