:relfileprefix: ../../../ [#boost-urls-url_view_base-host_name] = xref:boost.adoc[pass:[boost]]::xref:boost/urls.adoc[pass:[urls]]::xref:boost/urls/url_view_base.adoc[pass:[url_view_base]]::host_name Return the host name == Synopsis Declared in header `` [source,cpp,subs="verbatim,macros,-callouts"] ---- template StringToken::result_type host_name(StringToken&& token) const; ---- == Description If the host type is xref:boost/urls/host_type/name.adoc[host_type::name] , this function returns the name as a string. Otherwise an empty string is returned. Any percent-escapes in the string are decoded first. === Example [,cpp] ---- assert( url_view( "https://www%2droot.example.com/" ).host_name() == "www-root.example.com" ); ---- === Complexity Linear in `this->host_name().size()`. === Exception Safety Calls to allocate may throw. === BNF [,cpp] ---- host = IP-literal / IPv4address / reg-name IP-literal = "[" ( IPv6address / IPvFuture ) "]" reg-name = *( unreserved / pct-encoded / "-" / ".") ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[3.2.2. Host (rfc3986)]