### Function

# GLib Uri parse_scheme

since: 2.16

#### Declaration

    char*
    g_uri_parse_scheme (
      const char* uri
    )

#### Description

Gets the scheme portion of a URI string. RFC 3986 decodes the scheme as:

    URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]

Common schemes include `file`, `https`, `svn+ssh`, etc.

Available since: 2.16

#### Parameters

`uri`

  Type: `const char*`

  A valid URI.

  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

#### Return value

Type: `char*`

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

The caller of the function takes ownership of the data, and is responsible for freeing it.
The return value can be `NULL`.
The value is a NUL terminated UTF-8 string.