NSURL *url = [NSURL URLWithString:
@"http://maheswarancm.com:999/2012/April;URLParsing?
url=testURL&purpose=testing"];
NSLog(@"URL Scheme: %@", [url scheme]);
NSLog(@"URL Host: %@", [url host]);
NSLog(@"URL Port: %@", [url port]);
NSLog(@"URL Path: %@", [url path]);
NSLog(@"URL Relative path: %@", [url relativePath]);
NSLog(@"URL Path components as array: %@", [url pathComponents]);
NSLog(@"URL Parameter string: %@", [url parameterString]);
NSLog(@"URL Query: %@", [url query]);
NSLog(@"URL Fragment: %@", [url fragment]);
output:
URL Scheme: http
URL Host: maheswarancm.com
URL Port: 999
URL Path: /2012/April
URL Relative path: /2012/April
URL Path components as array: (
"/",
2012,
April
)
URL Parameter string: URLParsing
URL Query: url=testURL&purpose=testing
URL Fragment: (null)
No comments:
Post a Comment