[#boost-urls-url_view_base-port] = xref:boost/urls/url_view_base/port.adoc[boost::urls::url_view_base::port] :relfileprefix: ../../../ :mrdocs: Return the port == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L1587[boost/url/url_view_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- core::string_view port() const noexcept; ---- == Description If present, this function returns a string representing the port (which may be empty). Otherwise it returns an empty string. == Example [,cpp] ---- assert( url_view( "http://localhost.com:8080" ).port() == "8080" ); ---- == Complexity Constant. == Exception Safety Throws nothing. == BNF [,cpp] ---- port = *DIGIT ---- == Specification * https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3[] == Return Value The port as a string. == See Also xref:boost/urls/url_view_base/encoded_host_and_port.adoc[`encoded_host_and_port`], xref:boost/urls/url_view_base/has_port.adoc[`has_port`], xref:boost/urls/url_view_base/port_number.adoc[`port_number`]. [.small]#Created with https://www.mrdocs.com[MrDocs]#