NSString *str1 = @"wod to sefa afa to dfaes to reewer";
NSMutableString *str = [NSMutableString stringWithString:str1];
[str replaceCharactersInRange:[str rangeOfString:@"to"] withString:@"aa"];
NSRange range1 = [str rangeOfString:@"to" ];
NSLog(@"%ld-- %ld",range1.location,range1.length);
呵呵,暂时只能想到这个笨方法, |