1.将字符串 @"13385739275"中,从 8提取到3。替换 成@"**** "。及常用的手机号中间四位设为*号
//方法一
NSMutableString* mutableString = [NSMutableString stringWithFormat:@"13385739275"];
[mutableString replaceCharactersInRange:NSMakeRange(3, 4) withString:@"****"];
NSLog(@"mutableString:%@",mutableString);
//方法二 先删除 再插入
[mutableString deleteCharactersInRange:NSMakeRange(3,4)];
//NSLog(@"%@", mutableString);
[mutableString insertString:@"****" atIndex:3];
NSLog(@"mutableString2:%@", mutableString);
//方法三
NSString * mutableString3 = [mutableString stringByReplacingOccurrencesOfString:@"8573" withString:@"****"];
NSLog(@"mutableString3:%@", mutableString3);