:relfileprefix: ../../../ [#18C32A915879B37C39F05BB4988D257335FD6374] = Function authority_view::host_name pass:v,q[Return the host name] == Synopsis Declared in header `` [source,cpp,subs="verbatim,macros,-callouts"] ---- template StringToken::result_type host_name(StringToken&& token) const; ---- == Description pass:v,q[If the host type is] xref:boost/urls/host_type/name.adoc[host_type::name,] pass:v,q[this function returns the name as] pass:v,q[a string.] pass:v,q[Otherwise, if the host type is not an] pass:v,q[name, it returns an empty string.] pass:v,q[Any percent-escapes in the string are] pass:v,q[decoded first.] === Example [,cpp] ---- assert( url_view( "https://www%2droot.example.com/" ).host_name() == "www-root.example.com" ); ---- === Complexity pass:v,q[Linear in `this->host_name().size()`.] === Exception Safety pass:v,q[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)] == Return Value * `result_type` == Parameters |=== | Name | Type | *token* | `` |===