boost::urls::url::remove_port :: Boost Libraries Documentation

# boost::urls::url::remove_port

Remove the port

## Synopsis

Declared in `<boost/url/url.hpp>`

    url&
    remove_port() noexcept;

## Description

If a port exists, it is removed. The rest of the authority is unchanged.

## Example

    assert( url( "http://www.example.com:80" ).remove_port().authority().buffer() == "www.example.com" );

## Postconditions

    this->has_port() == false && this->port_number() == 0 && this->port() == ""

## Complexity

Linear in `this‐>size()`.

## Exception Safety

Throws nothing.

## BNF

    authority     = [ userinfo "@" ] host [ ":" port ]

    port          = *DIGIT

## Specification

- 3.2.3. Port (rfc3986)

## Return Value

`*this`

## See Also

`set_port`.

Created with MrDocs