Added safeRangeOfString to NSString.