[#boost-urls-url_view_base-scheme]
= xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/url_view_base.adoc[url&lowbar;view&lowbar;base]::scheme
:relfileprefix: ../../../
:mrdocs:

Return the scheme

== Synopsis

Declared in `&lt;https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#Lundefined[boost&sol;url&sol;url&lowbar;view&lowbar;base&period;hpp]&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
core::string&lowbar;view
scheme() const noexcept;
----

== Description

This function returns the scheme if it exists, without a trailing colon (&apos;&colon;&apos;)&period; Otherwise it returns an empty string&period; Note that schemes are case&hyphen;insensitive, and the canonical form is lowercased&period;

== Example

[,cpp]
----
assert( url_view( "http://www.example.com" ).scheme() == "http" );
----
== Exception Safety

Throws nothing&period;

== BNF

[,cpp]
----
scheme          = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )

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

absolute-URI    = scheme ":" hier-part [ "?" query ]
----
== Specification

* https://datatracker.ietf.org/doc/html/rfc3986#section-3.1[3&period;1&period; Scheme (rfc3986)]

== Return Value

The scheme as a string&period;

== See Also

xref:boost/urls/url_view_base/has_scheme.adoc[`has&lowbar;scheme`], xref:boost/urls/url_view_base/scheme_id.adoc[`scheme&lowbar;id`]&period;


[.small]#Created with https://www.mrdocs.com[MrDocs]#
