Replace string

iPhone SDK Tips & Tricks


NSMutableString *myString = [[NSMutableString alloc] initWithString:@”this and that”];
[
myString replaceOccurencesOfString:@”this” withString:@”that” options:NSCaseInSensitiveSearch range:NSMakeRange(0, [myString length])];
NSLog(@"%@",
myString);

or
myString = [myString stringByReplacingOccurrencesOfString:@"this"
withString:@"that
"];