parse_scheme


Description:

[ Version ( since = "2.16" ) ]
public static string? parse_scheme (string uri)

Gets the scheme portion of a URI string.

[RFC 3986](https://tools.ietf.org/html/rfc3986section-3) decodes the scheme as:

URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
Common schemes include `file`, `https`, `svn+ssh`, etc.

Example: Parse scheme:

public static int main (string[] args) {
string uri = "http://example.org/absolute/URI/with/absolute/path/to/resource.txt";

// Output: ``Uri scheme: http``
string scheme = Uri.parse_scheme (uri);
print ("Uri scheme: %s\n", scheme);
return 0;
}

valac --pkg glib-2.0 GLib.Uri.parse_scheme.vala

Parameters:

uri

a valid URI.

Returns:

The ‘scheme’ component of the URI, or null on error. The returned string should be freed when no longer needed.