0
    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 ?

2 Answers 2

7

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];
Sign up to request clarification or add additional context in comments.

2 Comments

SEPARATOR ? sorry im quite new to this object c
I fixed it thank you i replaced SEPARATOR WITH @"," THANKS THANKS THANKS
1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.