-(NSString )getSeparatedPhoneNumberWithString:(NSString )phoneString { NSCharacterSet *characterSet = [NSCharacterSet characterSetWithCharactersInString:@"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"];
NSString * string = phoneString;
//invertedSet方法是去反字符,把所有的除了characterSet里的字符都找出来(包含去空格功能)
NSCharacterSet *specCharacterSet = [characterSet invertedSet];
NSArray * strArr = [string componentsSeparatedByCharactersInSet:specCharacterSet];
return [strArr componentsJoinedByString:@""];
}
网友评论