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


Return the IPv6 Zone ID

== Synopsis


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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;xref:boost/urls/string_token.adoc[string&lowbar;token]::xref:boost/urls/string_token/StringToken.adoc[StringToken] StringToken = xref:boost/urls/string_token.adoc[string&lowbar;token]::xref:boost/urls/string_token/return_string.adoc[return&lowbar;string]&gt;
StringToken::result&lowbar;type
zone&lowbar;id(StringToken&& token = &lcub;&rcub;);
----

== Description


If the host type is xref:boost/urls/host_type.adoc[host&lowbar;type&colon;&colon;ipv6],        this function returns the Zone ID as        a string&period; Otherwise an empty string is returned&period;        Any percent&hyphen;escapes in the string are        decoded first&period;


=== Example

[,cpp]
----
assert( url_view( "http://[fe80::1%25eth0]/" ).zone_id() == "eth0" );
----

=== Complexity

Linear in `this&hyphen;&gt;encoded&lowbar;zone&lowbar;id()&period;size()`&period;


=== Exception Safety

Calls to allocate may throw&period;


=== BNF

[,cpp]
----
host        = IP-literal / IPv4address / reg-name

IP-literal = "[" ( IPv6address / IPv6addrz / IPvFuture  ) "]"

ZoneID = 1*( unreserved / pct-encoded )

IPv6addrz = IPv6address "%25" ZoneID
----

=== Specification

* link:https://datatracker.ietf.org/doc/html/rfc6874[Representing IPv6 Zone Identifiers in Address Literals and Uniform Resource Identifiers]

Return the IPv6 Zone ID

If the host type is xref:boost/urls/host_type.adoc[host&lowbar;type&colon;&colon;ipv6],        this function returns the Zone ID as        a string&period; Otherwise an empty string is returned&period;        Any percent&hyphen;escapes in the string are        decoded first&period;


=== Example

[,cpp]
----
assert( url_view( "http://[fe80::1%25eth0]/" ).zone_id() == "eth0" );
----

=== Complexity

Linear in `this&hyphen;&gt;encoded&lowbar;zone&lowbar;id()&period;size()`&period;


=== Exception Safety

Calls to allocate may throw&period;


=== BNF

[,cpp]
----
host        = IP-literal / IPv4address / reg-name

IP-literal = "[" ( IPv6address / IPv6addrz / IPvFuture  ) "]"

ZoneID = 1*( unreserved / pct-encoded )

IPv6addrz = IPv6address "%25" ZoneID
----

=== Specification

* link:https://datatracker.ietf.org/doc/html/rfc6874[Representing IPv6 Zone Identifiers in Address Literals and Uniform Resource Identifiers]





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