美文网首页
过滤字符串中不是数字的字符

过滤字符串中不是数字的字符

作者: 志在远航 | 来源:发表于2017-07-06 14:54 被阅读0次

    NSCharacterSet *setToRemove =

    [[ NSCharacterSet characterSetWithCharactersInString:@"0123456789"]

    invertedSet ];

    NSString *strPhone = @"";

    strPhone  = [[@"qwe123" componentsSeparatedByCharactersInSet:setToRemove] componentsJoinedByString:@""];

    ////////////////////////////////////////////////////////////////////////

    strPhone筛选后就是123

    相关文章

      网友评论

          本文标题:过滤字符串中不是数字的字符

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