diff options
Diffstat (limited to 'Source/SPArrayAdditions.m')
-rw-r--r-- | Source/SPArrayAdditions.m | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/Source/SPArrayAdditions.m b/Source/SPArrayAdditions.m index 9f9e7705..66a0ce1b 100644 --- a/Source/SPArrayAdditions.m +++ b/Source/SPArrayAdditions.m @@ -70,7 +70,7 @@ if ([result length]) [result appendString:@" "]; - [result appendString:[NSString stringWithFormat:@"\"%@\"", [component stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""]]]; + [result appendFormat:@"\"%@\"", [component stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""]]; } return result; } @@ -108,6 +108,19 @@ return result; } +- (NSString *)componentsJoinedAsCSV +{ + NSMutableString *result = [NSMutableString string]; + [result setString:@""]; + + for (NSString *component in self) + { + if ([result length]) + [result appendString: @","]; + [result appendFormat:@"\"%@\"", [[component description] stringByReplacingOccurrencesOfString:@"\"" withString:@"\"\""]]; + } + return result; +} - (NSArray *)subarrayWithIndexes:(NSIndexSet *)indexes { |