/* NSSet or NSArray: Show the contents as a comma-separated list Original Source: (See copyright notice at ) */ /*" Return a string that indicates the membership of a set or array, with each item separated by a comma and a space. "*/ - (NSString *) toCommaString { NSMutableString *buffer = [NSMutableString string]; NSEnumerator *theEnum = [self objectEnumerator]; NSString *theIdentifier; while (nil != (theIdentifier = [theEnum nextObject]) ) { [buffer appendString:[theIdentifier description]]; [buffer appendString:@", "]; } // Delete final gunk from the string if (![buffer isEqualToString:@""]) { [buffer deleteCharactersInRange:NSMakeRange([buffer length]-2, 2)]; } return buffer; }