Monday, September 15, 2014

The Uri type in C# may parse out the domain from a url!

A test like so would pass:

string url = "http://example.com/whatever?foo=bar&baz=qux";
Uri uri = new Uri(url);
Assert.AreEqual(uri.Host, "example.com");

No comments:

Post a Comment