I have an URL and need to extract a part of it.
The url is like this:
http://website.com/get.php?url=http://www.website2.com/index.html?articleID=123456
And I need to extract this part:
http://www.website2.com/index.html?articleID=123456
How would I do this in Objective-C?
See the
NSString
-rangeOfSubstring:
and-componentsSeparatedByString:
methods.In this case, you could just split the string at the "=".
First of all, create a NSURL. Then, use the
query
method to get the query string part:Then you can use the NSString methods to isolate the needed part.