This is what I used today:
Code:
NSString *string = @"blahblehbLuH";
NSRange startRange = [string rangeOfString:@"blah"];
NSRange endRange = [string rangeOfString:@"bluh"
options:NSCaseInsensitiveSearch];
NSRange subStringRange = NSMakeRange(startRange.length,
endRange.location - startRange.length);
NSString *subString = [string substringWithRange:subStringRange];
NSLog(@"%@", subString); // prints "bleh"
Basically, the first parameter for NSMakeRange function is the index location where the range starts, and the seconds parameter is the length of the sub string.
Colors are fun