[#boost-urls-url_view_base-encoded_query]
= xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/url_view_base.adoc[url&lowbar;view&lowbar;base]::encoded&lowbar;query
:relfileprefix: ../../../
:mrdocs:

Return the query

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:boost/urls/pct_string_view.adoc[pct&lowbar;string&lowbar;view]
encoded&lowbar;query() const noexcept;
----

== Description

If this contains a query, it is returned as a string (which may be empty)&period; Otherwise, an empty string is returned&period; The returned string may contain percent escapes&period;

== Example

[,cpp]
----
assert( url_view( "/sql?id=42&name=jane%2Ddoe&page+size=20" ).encoded_query() == "id=42&name=jane%2Ddoe&page+size=20" );
----
== Complexity

Constant&period;

== Exception Safety

Throws nothing&period;

== BNF

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

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

* https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3&period;4&period; Query (rfc3986)]
* https://en.wikipedia.org/wiki/Query_string[Query string (Wikipedia)]

== Return Value

The query as a string&period;

== See Also

xref:boost/urls/url_view_base/encoded_params.adoc[`encoded&lowbar;params`], xref:boost/urls/url_view_base/has_query.adoc[`has&lowbar;query`], xref:boost/urls/url_view_base/params-065.adoc[`params`], xref:boost/urls/url_view_base/query.adoc[`query`]&period;


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