美文网首页
iOS-过滤特殊字符

iOS-过滤特殊字符

作者: 香蕉你个菠萝 | 来源:发表于2018-04-25 09:16 被阅读76次

    通讯录复制过来的手机号为13位,含2位特殊字符

    //过滤特殊字符
    NSCharacterSet *setToRemove = [[ NSCharacterSet characterSetWithCharactersInString:@"0123456789"]invertedSet];
    NSString *ph = [[phoneStr componentsSeparatedByCharactersInSet:setToRemove]componentsJoinedByString:@""];

    相关文章

      网友评论

          本文标题:iOS-过滤特殊字符

          本文链接:https://www.haomeiwen.com/subject/uorelftx.html