[#boost-urls-decode-07] = xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::decode :relfileprefix: ../../ :mrdocs: Return a percent‐decoded string == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/decode.hpp#Lundefined[boost/url/decode.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<xref:boost/urls/string_token/StringToken.adoc[string_token::StringToken] StringToken = xref:boost/urls/string_token/return_string.adoc[string_token::return_string]> system::result<StringToken::result_type> decode( core::string_view s, xref:boost/urls/encoding_opts.adoc[encoding_opts] opt = {}, StringToken&& token = {}) noexcept; ---- == Description This function percent‐decodes the specified string and returns the result using any xref:boost/urls/string_token.adoc[`string_token`]. The string is validated before decoding; malformed escapes cause the returned result to hold an error. == Example [,cpp] ---- auto plain = decode( "My%20Stuff" ); assert( plain && *plain == "My Stuff" ); ---- == Exception Safety Calls to allocate may throw. Validation errors are reported in the returned result. == Specification * https://datatracker.ietf.org/doc/html/rfc3986#section-2.1[2.1. Percent‐Encoding (rfc3986)] == Return Value A result containing the decoded string in the format described by the passed string token. == Parameters [cols="1,4"] |=== |Name|Description | *s* | The string to decode. | *opt* | The decoding options. If omitted, the default options are used. | *token* | A string token. |=== == See Also xref:boost/urls/decode-01.adoc[`decode`], xref:boost/urls/decoded_size.adoc[`decoded_size`], xref:boost/urls/encoding_opts.adoc[`encoding_opts`], xref:boost/urls/string_token/return_string.adoc[`string_token::return_string`]. [.small]#Created with https://www.mrdocs.com[MrDocs]#