Home | Libraries | People | FAQ | More |
Validate and decode a string view.
Defined in header <boost/url/decode.hpp>
template< class CharSet = grammar::all_chars_t> result< decode_view > decode( string_view s, decode_opts const& opt = {}, CharSet const& allowed = {});
This function returns a view that applies percent-decoding to the given percent-encoded string, by converting escape sequences into their character equivalent. The function validates the input string and returns a view of the decoded bytes. If the input string is invalid, the result contains an error.
result< decode_view > r = decode( "Program%20Files" ); assert( r.has_value() ); decode_view v = *r; assert( v == "Program Files" ); assert( v.size() == 13 ); assert( v.encoded().size() == 15 );
Throws nothing.
The number of bytes written to the destination buffer, which does not include any null termination.
Name |
Description |
---|---|
|
The string to decode. |
|
The set of characters allowed to appear unescaped. This type must
satisfy the requirements of CharSet. If this
parameter is omitted, then no characters are considered special.
The character set is ignored if |
|
The options for decoding. If this parameter is omitted, the default options will be used. |
Convenience header <boost/url.hpp>