NSURL

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
NSString *urlString = @"http://www.books.com:3321/lib/query;steve?key=job&sort=asc#chapter2";
NSURL *url = [NSURL URLWithString:urlString];

NSLog(@"url.absoluteString %@",url.absoluteString);
NSLog(@"url.absoluteURL %@",url.absoluteURL);
NSLog(@"url.baseURL %@",url.baseURL);

NSLog(@"url.scheme %@",url.scheme);
NSLog(@"url.host %@",url.host);
NSLog(@"url.port %@",url.port);
NSLog(@"url.query %@",url.query);
NSLog(@"url.fragment %@",url.fragment);
NSLog(@"url.parameterString %@",url.parameterString);
NSLog(@"url.pathExtension %@",url.pathExtension);
NSLog(@"url.path %@",url.path);
NSLog(@"url.pathComponents %@",url.pathComponents);
NSLog(@"url.lastPathComponent %@",url.lastPathComponent);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
url.absoluteString http://www.books.com:3321/lib/query;steve?key=job&sort=asc#chapter2
url.absoluteURL http://www.books.com:3321/lib/query;steve?key=job&sort=asc#chapter2
url.baseURL (null)
url.scheme http
url.host www.books.com
url.port 3321
url.query key=job&sort=asc
url.fragment chapter2
url.parameterString steve
url.pathExtension
url.path /lib/query
url.pathComponents (
"/",
lib,
query
)
url.lastPathComponent query