[#boost-urls-url_view_base-has_fragment]
= xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/url_view_base.adoc[url&lowbar;view&lowbar;base]::has&lowbar;fragment
:relfileprefix: ../../../
:mrdocs:


Return true if a fragment is present

== Synopsis


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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
bool
has&lowbar;fragment() const noexcept;
----

== Description


This function returns true if the url        contains a fragment&period;        An empty fragment is distinct from        no fragment&period;


=== Example

[,cpp]
----
assert( url_view( "http://www.example.com/index.htm#anchor" ).has_fragment() );
----

=== Complexity

Constant&period;


=== Exception Safety

Throws nothing&period;


=== BNF

[,cpp]
----
URI           = scheme ":" hier-part [ "?" query ] [ "#" fragment ]

relative-ref  = relative-part [ "?" query ] [ "#" fragment ]
----

=== Specification

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

Return true if a fragment is present

This function returns true if the url        contains a fragment&period;        An empty fragment is distinct from        no fragment&period;


=== Example

[,cpp]
----
assert( url_view( "http://www.example.com/index.htm#anchor" ).has_fragment() );
----

=== Complexity

Constant&period;


=== Exception Safety

Throws nothing&period;


=== BNF

[,cpp]
----
URI           = scheme ":" hier-part [ "?" query ] [ "#" fragment ]

relative-ref  = relative-part [ "?" query ] [ "#" fragment ]
----

=== Specification

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



== See Also


xref:boost/urls/url_view_base/encoded_fragment.adoc[encoded&lowbar;fragment],            xref:boost/urls/url_view_base/fragment.adoc[fragment]&period;



xref:boost/urls/url_view_base/encoded_fragment.adoc[encoded&lowbar;fragment],            xref:boost/urls/url_view_base/fragment.adoc[fragment]&period;






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