[#boost-urls-url_view_base-host_name] = xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/url_view_base.adoc[url_view_base]::host_name :relfileprefix: ../../../ :mrdocs: Return the host name == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L1378[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<xref:boost/urls/string_token.adoc[string_token]::xref:boost/urls/string_token/StringToken.adoc[StringToken] StringToken = xref:boost/urls/string_token.adoc[string_token]::xref:boost/urls/string_token/return_string.adoc[return_string]> StringToken::result_type host_name(StringToken&& token = {}); ---- == Description If the host type is xref:boost/urls/host_type.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 * https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2[] == Return Value The host name as a string. == Parameters [cols=2] |=== | Name | Description | *token* | A string token customization. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#