Where is my mistake?
The mistake is that you're not using the right tool for the task.
Anyways, you seem to be confusing the length and the ending location of ranges. NSMakeRange()
takes a location and a length, not the starting and the ending location.
Also, don't expect - [NSString rangeOfString:]
to magically guess what you are trying to do. It will return the first occurrence of the given substring, and here that is not what you want.