boost::urls::url_base::remove_fragment :: Boost Libraries Documentation

# boost::urls::url_base::remove_fragment

Remove the fragment

## Synopsis

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

    url_base&
    remove_fragment() noexcept;

## Description

This function removes the fragment. An empty fragment is distinct from having no fragment.

## Example

    assert( url( "?first=john&last=doe#anchor" ).remove_fragment().buffer() == "?first=john&last=doe" );

## Postconditions

    this->has_fragment() == false && this->encoded_fragment() == ""

## Complexity

Constant.

## Exception Safety

Throws nothing.

## BNF

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

## Specification

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

## Return Value

`*this`

## See Also

`remove_fragment`, `set_encoded_fragment`, `set_fragment`.

Created with MrDocs