I have a string as per below:
$ab$c x$yz$
The string would always start with $ and would end with a $ character. I wish to find the range of the start $ and end $.
I tried: NSRange range = [myStr rangeOfString:@"$"];
I get the output as (NSRange) $0 = location=0
for its location so I am assuming that it is just returning the range of first '$' found in the string.
How do I get range of start $ and end $?
What I am exactly trying to do here is I am using the below method:
- (BOOL)searchBar:(UISearchBar *)searchBar shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
So when I type text as '$' I wish to check if '$' is in between start '$' and end '$'. So I am finding it out using the range. If range of '$' I type is between the range of start '$' and end '$' then do this, else do that.