
/*
	NSSet or NSArray: Show the contents as a comma-separated list
	Original Source: <http://cocoa.karelia.com/Foundation_Categories/NSSet__Show_the_con.m>
	(See copyright notice at <http://cocoa.karelia.com>)
*/

/*"	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;
}