title: Reliable way to compare two NSURL or one NSURL and an NSString?
body: <p>I recently had a problem when comparing two NSURLs and compare one NSURL with an NSString(which is a URL address), the situation is I got an NSURLRequest from somewhere, I may or may not know the URL address it points to, and I have an URL NSString, say "http://m.google.com", now I need to check if the URL in that NSURLRequest is the same as the URL string I had:</p>
  
  <pre><code>[[request.URL.absoluteString lowercaseString] isEqualToString: [self.myAddress lowercaseString]];
  </code></pre>
  
  <p>this returns NO as the <code>absoluteString</code> gives me "http://m.google.com/" whereas my string is "http://m.google.com" without a slash in the end, even if I create the NSURLRequest using</p>
  
  <pre><code>[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://m.google.com"]]
  </code></pre>
  
  <p>it still gives me "http://m.google.com/" for <code>absoluteString</code>, I wonder is there any reliable way to compare to NSURL or one NSURL and one NSString?</p>
  
  <ol>
  <li><p>check if one 'contains' another, but this is not reliable as 'http://m.google.com/blabla' contains 'http://m.google.com'.</p></li>
  <li><p>convert the NSString to NSURL and use the <code>isEqual</code> method to compare two NSURL and hopefully NSURL's implementation of <code>isEqual</code> can figure it out?</p></li>
  <li><p>based on step 2, but convert each NSURL to a standard URL using <code>standardizedURL</code>?</p></li>
  </ol>
  
  <p>Thanks a lot!</p>