Last active
December 26, 2015 15:49
-
-
Save appyaaron/7175453 to your computer and use it in GitHub Desktop.
A nice and simple way to get the characters in-between a start character and an end character using NSRange.
Replace cell.text with your string.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSString *param3 = nil; | |
NSRange start3 = [cell.text rangeOfString:@"thestartcharacterhere"]; | |
if (start3.location != NSNotFound) | |
{ | |
param3 = [cell.text substringFromIndex:start3.location + start3.length]; | |
NSRange end3 = [param3 rangeOfString:@"theendcharacterhere"]; | |
if (end3.location != NSNotFound) | |
{ | |
param3 = [param3 substringToIndex:end3.location]; | |
} | |
NSLog(@"%@", param3); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment