下面替換特殊字符是我的代碼:從字符串從一個數組
NSString *str = [EpiC objectAtIndex:indexPath.row];
NSCharacterSet *doNotWant = [NSCharacterSet characterSetWithCharactersInString:@"\/"];
str = [[str componentsSeparatedByCharactersInSet: doNotWant] componentsJoinedByString: @"\"];
NSLog(@"%@", str);
它顯示錯誤如下:在該行 未知的轉義序列:
NSCharacterSet *doNotWant = [NSCharacterSet characterSetWithCharactersInString:@"\/"];
和意外「@ '在程序中,在這一行:
NSCharacterSet *doNotWant = [NSCharacterSet characterSetWithCharactersInString:@"\"];
你能證明你的字符串'str' –
@ Anbu.Karthik FSJ \/6356232這是字符串,我想這是FSJ \ 6356232 –