How can I get a string between 2 known strings? For example:
<id> 100 </id>
I want to get the 100 from this string.
I have try this code but it doesn´t work. The NSLog
is:
<id>100
Code:
NSString *serverOutput = @"<id>100</id>";
NSRange start = [serverOutput rangeOfString:@"<id>"];
NSRange end = [serverOutput rangeOfString:@"</id>"];
NSLog(@"%@",[serverOutput substringWithRange:NSMakeRange(start.location, end.location)]);