字符串去掉杂符 -- 可任意过滤杂符

        // 去掉杂符

        NSCharacterSet *otherchar = [NSCharacterSet characterSetWithCharactersInString:@"[]{},!@#%-*+=_\\|~(<>$%^&*)_+ "];

        NSString *subphonenum = [[subphonenumtemp componentsSeparatedByCharactersInSet: otherchar] componentsJoinedByString: @""];

        

        //  人为修改电话号码 -- 分机前增加 “,”

        if (subphonenum.length>0)

            pnum = [NSString stringWithFormat:@"%@,%@",mainphonenum,subphonenum];

        else

            pnum = mainphonenum;

你可能感兴趣的:(ios,技巧有关)