正常使用字符替换并不能去除通讯录中获取的电话号码中的空格字符,亲测以下方法可以做到
NSString *cleaned = [[phoneString componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] componentsJoinedByString:@""];
本文介绍了一种有效的方法来清除从通讯录中获取的电话号码中的空格字符。通过使用NSCharacterSet和NSString的相关方法,可以实现电话号码字符串中空格的彻底移除。
正常使用字符替换并不能去除通讯录中获取的电话号码中的空格字符,亲测以下方法可以做到
NSString *cleaned = [[phoneString componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] componentsJoinedByString:@""];
转载于:https://www.cnblogs.com/wj0920wjx/p/8807297.html

被折叠的 条评论
为什么被折叠?