I need to determine whether a string (sourceString
) contains another string (queryString
) and if it does, at what offset.
I'm guessing that NSScanner might do the trick but I don't fully understand the documentation.
Let's say sourceString = @"What's the weather in London today?"
If I set queryString
to equal @"What's the weather"
, I'd like a method that would determine that, in this case, YES
(sourceString
does contain queryString
) and the offset is 0 (i.e. at the start of sourceString
).
Any suggestions?