componentsSeperatedByString
inを使用して複数の単語/タグを削除する良い方法はありNSString
ますか?私を驚かせた唯一のアイデアは、このメソッドを3回呼び出して、削除する定義済みのタグをすべて削除することでした。しかし、それはそれほど良いスタイルではないようです。それで、これを行うためのより良い方法はありますか?
#define REMOVE_TAG_1 @"cs193pspot"
#define REMOVE_TAG_2 @"portrait"
#define REMOVE_TAG_3 @"landscape"
// Formats the subtitle by removing the defined tags
- (NSString *)formatSubtitle:(NSString *)subtitle
{
NSArray *tagsToKeep = [subtitle componentsSeparatedByString:[NSString stringWithFormat:@"%@",REMOVE_TAG_1]];
NSLog(@"%@",[tagsToKeep description]);
return nil;
}