Created
November 12, 2012 17:09
-
-
Save odrobnik/4060573 to your computer and use it in GitHub Desktop.
Comparing URLs
This file contains 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
NSURL *a = [NSURL URLWithString:@"http://google.com/oliver.html"]; | |
NSURL *b = [NSURL URLWithString:@"oliver.html" relativeToURL:[NSURL URLWithString:@"http://google.com"]]; | |
if([a isEqual:b]) { | |
NSLog(@"Same"); // Not run | |
} | |
if([[a absoluteURL] isEqual:[b absoluteURL]]) { | |
NSLog(@"Same"); // Still not run | |
} | |
if([[a URLByStandardizingPath] isEqual:[b URLByStandardizingPath]]) { | |
NSLog(@"Same"); // Still not run | |
} | |
if([[a absoluteString] isEqualToString:[b absoluteString]]) { | |
NSLog(@"Same"); // Still not run | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment