:relfileprefix: ../../../ [#6B2F974F2C894520AC2C1856E4937046D9E06F0A] = Function static_url::set_port pass:v,q[Set the port] == Synopsis Declared in header `` [source,cpp,subs="verbatim,macros,-callouts"] ---- xref:boost/urls/static_url.adoc[static_url]& set_port(string_view s); ---- == Description pass:v,q[This port is set to the string, which] pass:v,q[must contain only digits or be empty.] pass:v,q[An empty port string is distinct from] pass:v,q[having no port.] === Example [,cpp] ---- assert( url( "http://www.example.com" ).set_port( "8080" ).authority().buffer() == "www.example.com:8080" ); ---- === Postconditions [,cpp] ---- this->has_port() == true && this->port_number() == n && this->port() == std::to_string(n) ---- === Exception Safety pass:v,q[Strong guarantee.] pass:v,q[Calls to allocate may throw.] pass:v,q[Exceptions thrown on invalid input.] === BNF [,cpp] ---- port = *DIGIT ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3[ 3.2.3. Port (rfc3986)] == Return Value * `` == Parameters |=== | Name | Type | *s* | `string_view` |===