use*_*273 0 arrays string iphone cocoa objective-c
NSArray *ArtistNames = [RawData componentsMatchedByRegex:regEx1];
NSCharacterSet *doNotWant = [NSCharacterSet characterSetWithCharactersInString:@"'"];
ArtistNames = [[ArtistNames componentsSeparatedByCharactersInSet: doNotWant] componentsJoinedByString: @"'"];
Run Code Online (Sandbox Code Playgroud)
那是我的代码,基本上我不能使用它,因为ArtistNames是一个数组而不是字符串,我将如何通过这个?
我想你是以错误的顺序调用你的方法.尝试将其分成多个语句.
// 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];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
361 次 |
| 最近记录: |