views:

73

answers:

2
    NSArray *ArtistNames = [RawData componentsMatchedByRegex:regEx1]; 
    NSCharacterSet *doNotWant = [NSCharacterSet characterSetWithCharactersInString:@"'"];
    ArtistNames = [[ArtistNames componentsSeparatedByCharactersInSet: doNotWant] componentsJoinedByString: @"'"];

Thats my code at the moment basically i cannot use it as ArtistNames is a array not a string, how would i get past this ?

+6  A: 

I think you're calling your methods in the wrong order. Try breaking it into multiple statements.

// The separator should be some string of characters guaranteed to not be in any of the strings in the array.
#define SEPARATOR @"---***---"

NSArray *artistNames = [RawData componentsMatchedByRegex:regEx1]; 
NSString *doNotWant = @"'"
NSString *combinedNames = [artistNames componentsJoinedByString:SEPARATOR];
combinedNames = [combinedNames stringByReplacingOccurrencesOfString:doNotWant withString:@""];
artistNames = [combinedNames componentsSeparatedByString:SEPARATOR];
Robot K
SEPARATOR ? sorry im quite new to this object c
I fixed it thank you i replaced SEPARATOR WITH @"," THANKS THANKS THANKS
Up-voted for "NSString *doNotWant..." :-)
Joshua Nozzi
+1  A: 

Why not just loop over the array and create the second array yourself?

Peter Hosey