You can use a regex via RegexKitLite:
NSString *mainString = @"Hi how are you GET=dsjghdsghghdsjkghdjkhsg";
NSString *matchedString = [mainString stringByMatching:@"GET=(.*)" capture:1L];
// matchedString == @"dsjghdsghghdsjkghdjkhsg";
The regex used, GET=(.*)
, basically says "Look for GET=
, and then grab everything after that". The ()
specifies a capture group, which are useful for extracting just part of a match. Capture groups begin at 1, with capture group 0 being "the entire match". The part inside the capture group, .*
, says "Match any character (the .
) zero or more times (the *
)".
If the string, in this case mainString
, is not matched by the regex, then matchedString
will be NULL
.