NSString *string=@"13721701737";
//指定值替换
string=[self stringByReplacingOccurrencesOfString:@"2170" withString:@"++++"];
//获取某个位置的字符
NSString *string1=[string substringWithRange:NSMakeRange(3,4)];
//直接替换某个位置的值
NSString *str4 = [string stringByReplacingCharactersInRange:NSMakeRange(3, 4) withString:@"****"];
//前三个 ------ 三个之后的
phoneString=[NSString stringWithFormat:@"%@ %@",[string substringToIndex:3],[string substringFromIndex:3]];
网友评论