对字符串(手机号)转换为前3 后3 中4*

- (NSString *)formatPhone4n4
{
    NSInteger len = self.length;
    if (len < 7) {
        return self;
    }
    NSRange range = NSMakeRange(3, len - 7);
    NSMutableString *points = [[NSMutableString alloc]init];
    for (int i = 0; i < 4; i++) {
        [points appendString:@"*"];
    }
    return [self stringByReplacingCharactersInRange:range withString:points];
}


你可能感兴趣的:(iOS)