[#boost-urls-pct_string_view-decode]
= xref:boost/urls/pct_string_view/decode.adoc[boost::urls::pct&lowbar;string&lowbar;view::decode]
:relfileprefix: ../../../
:mrdocs:

Return the string with percent&hyphen;decoding

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;xref:boost/urls/string_token/StringToken.adoc[string&lowbar;token::StringToken] StringToken = xref:boost/urls/string_token/return_string.adoc[string&lowbar;token::return&lowbar;string]&gt;
StringToken::result&lowbar;type
decode(
    xref:boost/urls/encoding_opts.adoc[encoding&lowbar;opts] opt = &lcub;&rcub;,
    StringToken&& token);
----

== Description

This function converts percent escapes in the string into ordinary characters and returns the result&period; When called with no arguments, the return type is `std&colon;&colon;string`&period; Otherwise, the return type and style of output is determined by which string token is passed&period;

== Example
[,cpp]
----
assert( pct_string_view( "Program%20Files" ).decode() == "Program Files" );
----
== Complexity
Linear in `this&hyphen;&gt;size()`&period;

== Exception Safety
Calls to allocate may throw&period; String tokens may throw exceptions&period;

== Return Value

The decoded string&period;

== Parameters

[cols=2]
|===
| Name
| Description
| *opt*
| The options for encoding&period; If this parameter is omitted, the default options are used&period;
| *token*
| An optional string token&period; If this parameter is omitted, then a new `std&colon;&colon;string` is returned&period; Otherwise, the function return type is the result type of the token&period;
|===

== See Also

xref:boost/urls/encoding_opts.adoc[`encoding&lowbar;opts`], xref:boost/urls/string_token/return_string.adoc[`string&lowbar;token&colon;&colon;return&lowbar;string`]&period;


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