Uri class and parser

Jacob Carlborg doob at me.com
Thu Oct 25 04:44:10 PDT 2012


On 2012-10-25 13:24, Mike van Dongen wrote:

> Now it allows you to create/edit an URI. You can do so by using an array
> or string, whichever you prefer.
> I also added a toString() method and fixed the indentation to 4 spaces,
> instead of 1 tab.
>
> uri = new Uri();
> uri.scheme = "foo";
> uri.username = "username";
> uri.password = "password";
> uri.host = "example.com";
> uri.port = 8042;
> uri.path = ["over", "there", "index.dtb"];
> uri.query = ["type": "animal", "name": "narwhal", "novalue": ""];
> uri.fragment = "nose";
> assert(uri.toString() ==
> "foo://username:password@example.com:8042/over/there/index.dtb?novalue=&name=narwhal&type=animal#nose");

Awesome, now it's only missing documentation :)

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list