:relfileprefix: ../../../ [#51A13F35B8A6E1F189352822F3125B00DB45BACA] = Function static_url::set_host_name pass:v,q[Set the host to a name] == Synopsis Declared in header `` [source,cpp,subs="verbatim,macros,-callouts"] ---- xref:boost/urls/static_url.adoc[static_url]& set_host_name(string_view s); ---- == Description pass:v,q[The host is set to the specified string,] pass:v,q[which may be empty.] pass:v,q[Reserved characters in the string are] pass:v,q[percent-escaped in the result.] pass:v,q[The host type is] xref:boost/urls/host_type/name.adoc[host_type::name.] === Example [,cpp] ---- assert( url( "http://www.example.com/index.htm").set_host_name( "localhost" ).host_address() == "localhost" ); ---- === Postconditions [,cpp] ---- this->has_authority() == true && this->host_ipv6_address() == addr && this->host_type() == host_type::name ---- === Exception Safety pass:v,q[Strong guarantee.] pass:v,q[Calls to allocate may throw.] === BNF [,cpp] ---- 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 * `` == Parameters |=== | Name | Type | *s* | `string_view` |===