iOS中NSCharacterSet的使用详解 - CSDN博客
在不同的字符上做过滤、
if( [strPath rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"/\\"]].location!=NSNotFound )
/例子1:去除两边的空格
string = [stringstringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
//过滤一些字符
NSString *string = @"123a bc 9ABC";
NSCharacterSet *cs = [[NSCharacterSet characterSetWithCharactersInString:NUM] invertedSet]; NSString *filtered = [[string componentsSeparatedByCharactersInSet:cs] componentsJoinedByString:@""];
网友评论