parseURL

Attempts to parse an URL from a string and returns the specified component of the URL or $(D_PSYMBOL URL) if no component is specified.

  1. auto parseURL(char[] source)
  2. URL parseURL(char[] source)
    @nogc pure
    parseURL
    (
    const char[] source
    )

Parameters

source char[]

The string containing the URL.

Return Value

Type: URL

Requested URL component.

Examples

auto u = parseURL("http://example.org:5326");
assert(u.scheme == parseURL!"scheme"("http://example.org:5326"));
assert(u.host == parseURL!"host"("http://example.org:5326"));
assert(u.user == parseURL!"user"("http://example.org:5326"));
assert(u.pass == parseURL!"pass"("http://example.org:5326"));
assert(u.path == parseURL!"path"("http://example.org:5326"));
assert(u.query == parseURL!"query"("http://example.org:5326"));
assert(u.fragment == parseURL!"fragment"("http://example.org:5326"));
assert(u.port == parseURL!"port"("http://example.org:5326"));

Meta