[#boost-urls-url_base-remove_fragment]
= xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/url_base.adoc[url&lowbar;base]::remove&lowbar;fragment
:relfileprefix: ../../../
:mrdocs:

Remove the fragment

== Synopsis

Declared in `&lt;https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_base.hpp#Lundefined[boost&sol;url&sol;url&lowbar;base&period;hpp]&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:boost/urls/url_base.adoc[url&lowbar;base]&
remove&lowbar;fragment() noexcept;
----

== Description

This function removes the fragment&period; An empty fragment is distinct from having no fragment&period;

== Example

[,cpp]
----
assert( url( "?first=john&last=doe#anchor" ).remove_fragment().buffer() == "?first=john&last=doe" );
----
== Postconditions

[,cpp]
----
this->has_fragment() == false && this->encoded_fragment() == ""
----
== Complexity

Constant&period;

== Exception Safety

Throws nothing&period;

== BNF

[,cpp]
----
fragment    = *( pchar / "/" / "?" )
----
== Specification

* https://datatracker.ietf.org/doc/html/rfc3986#section-3.5[3&period;5&period; Fragment]

== Return Value

`&ast;this`

== See Also

`remove&lowbar;fragment`, xref:boost/urls/url_base/set_encoded_fragment.adoc[`set&lowbar;encoded&lowbar;fragment`], xref:boost/urls/url_base/set_fragment.adoc[`set&lowbar;fragment`]&period;


[.small]#Created with https://www.mrdocs.com[MrDocs]#
