Created
September 9, 2012 14:09
-
-
Save avyavya/3684559 to your computer and use it in GitHub Desktop.
NSURL properties.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// vim: set ts=4 sts=4 sw=4 et nosi noai ft=objc : | |
// usage: | |
// $ clang -g -framework Foundation -o test test.m | |
#import <Foundation/Foundation.h> | |
int main(int argc, char *argv[]) | |
{ | |
@autoreleasepool { | |
NSURL *url = [NSURL URLWithString:@"https://user:pass@www.google.com/foo/bar/baz.ext?q=query#hash"]; | |
NSLog(@"%@", url); | |
NSLog(@"absoluteString: %@", [url absoluteString]); | |
NSLog(@"baseURL: %@", [url baseURL]); | |
NSLog(@"fragment: %@", [url fragment]); | |
NSLog(@"host: %@", [url host]); | |
NSLog(@"lastPathComponent: %@", [url lastPathComponent]); | |
NSLog(@"parameterString: %@", [url parameterString]); | |
NSLog(@"password: %@", [url password]); | |
NSLog(@"path: %@", [url path]); | |
NSLog(@"pathComponents: %@", [url pathComponents]); | |
NSLog(@"pathExtension: %@", [url pathExtension]); | |
NSLog(@"port: %@", [url port]); | |
NSLog(@"query: %@", [url query]); | |
NSLog(@"relativePath: %@", [url relativePath]); | |
NSLog(@"relativeString: %@", [url relativeString]); | |
NSLog(@"resourceSpecifier: %@", [url resourceSpecifier]); | |
NSLog(@"scheme: %@", [url scheme]); | |
NSLog(@"standardizedURL: %@", [url standardizedURL]); | |
NSLog(@"user: %@", [url user]); | |
return 0; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2012-09-09 23:09:37.041 tmp[61459:707] https://user:pass@www.google.com/foo/bar/baz.ext?q=query#hash | |
2012-09-09 23:09:37.044 tmp[61459:707] absoluteString: https://user:pass@www.google.com/foo/bar/baz.ext?q=query#hash | |
2012-09-09 23:09:37.044 tmp[61459:707] baseURL: (null) | |
2012-09-09 23:09:37.046 tmp[61459:707] fragment: hash | |
2012-09-09 23:09:37.047 tmp[61459:707] host: www.google.com | |
2012-09-09 23:09:37.047 tmp[61459:707] lastPathComponent: baz.ext | |
2012-09-09 23:09:37.048 tmp[61459:707] parameterString: (null) | |
2012-09-09 23:09:37.048 tmp[61459:707] password: pass | |
2012-09-09 23:09:37.049 tmp[61459:707] path: /foo/bar/baz.ext | |
2012-09-09 23:09:37.049 tmp[61459:707] pathComponents: ( | |
"/", | |
foo, | |
bar, | |
"baz.ext" | |
) | |
2012-09-09 23:09:37.049 tmp[61459:707] pathExtension: ext | |
2012-09-09 23:09:37.050 tmp[61459:707] port: (null) | |
2012-09-09 23:09:37.050 tmp[61459:707] query: q=query | |
2012-09-09 23:09:37.050 tmp[61459:707] relativePath: /foo/bar/baz.ext | |
2012-09-09 23:09:37.051 tmp[61459:707] relativeString: https://user:pass@www.google.com/foo/bar/baz.ext?q=query#hash | |
2012-09-09 23:09:37.051 tmp[61459:707] resourceSpecifier: //user:pass@www.google.com/foo/bar/baz.ext?q=query#hash | |
2012-09-09 23:09:37.052 tmp[61459:707] scheme: https | |
2012-09-09 23:09:37.052 tmp[61459:707] standardizedURL: https://user:pass@www.google.com/foo/bar/baz.ext?q=query#hash | |
2012-09-09 23:09:37.052 tmp[61459:707] user: user |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment