I have mainString from which i need to get the part of the string after finding a keyword.
NSString *mainString = “Hi how are you GET=dsjghdsghghdsjkghdjkhsg”;
now I need to get the string after the keyword “GET=”.
Waiting for a reply.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use a regex via RegexKitLite:
The regex used,
GET=(.*), basically says “Look forGET=, 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, thenmatchedStringwill beNULL.