虽然挺简单,但怕忘了,以防万一!!!
NSString *a = @"13781213137";
NSString *string=[a stringByReplacingOccurrencesOfString:[a substringWithRange:NSMakeRange(3,4)]withString:@"****"];
NSLog(@"b:%@",string);
//substringWithRange:NSMakeRange(3,4) 从第三位开始截取四个字符
虽然挺简单,但怕忘了,以防万一!!!
NSString *a = @"13781213137";
NSString *string=[a stringByReplacingOccurrencesOfString:[a substringWithRange:NSMakeRange(3,4)]withString:@"****"];
NSLog(@"b:%@",string);
//substringWithRange:NSMakeRange(3,4) 从第三位开始截取四个字符