is it possible to use the method rangeOfString
to search for a NSString
starting from a given offset?
Something more similar to the strpos
function in PHP.
Thanks
Not -rangeOfString:
, but a similar method - -rangeOfString:options:range:
.
(Edit: An example)
NSString *string = @"YaddaYaddaYadda";
NSString *searchString = @"Yadda";
NSRange thisCharRange, searchCharRange;
searchCharRange = NSMakeRange(3, [string length]);
thisCharRange = [string rangeOfString:searchString options:0 range:searchCharRange];
NSLog(@"thisCharRange: %@", NSStringFromRange(thisCharRange));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With