boost::urls::url_base::remove_query :: Boost Libraries Documentation

# boost::urls::url_base::remove_query

Remove the query

## Synopsis

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

    url_base&
    remove_query() noexcept;

## Description

If a query is present, it is removed. An empty query is distinct from having no query.

## Example

    assert( url( "http://www.example.com?id=42" ).remove_query().buffer() == "http://www.example.com" );

## Postconditions

    this->has_query() == false && this->params().empty()

## Exception Safety

Throws nothing.

## BNF

    query           = *( pchar / "/" / "?" )

    query-param     = key [ "=" value ]
    query-params    = [ query-param ] *( "&" query-param )

## Specification

- https://datatracker.ietf.org/doc/html/rfc3986#section-3.4

- https://en.wikipedia.org/wiki/Query_string

## Return Value

`*this`

## See Also

`encoded_params`, `params`, `set_encoded_query`, `set_query`.

Created with MrDocs