Return a percent-encoded string
Synopsis
Declared in header </boost/url/encode.hpp#L184[boost/url/encode.hpp,window=blank_]>
template<
class StringToken = string_token::return_string,
class CharSet>
StringToken::result_type
encode(
string_view s,
const CharSet& unreserved,
encoding_opts opt = = {},
StringToken&& token) noexcept;
Description
This function applies percent-encoding to the string using the given options and character set, and returns the result as a string when called with default arguments.
Example
encoding_opts opt;
opt.space_as_plus = true;
std::string s = encode( "My Stuff", opt, pchars );
assert( s == "My+Stuff" );
Exception Safety
Calls to allocate may throw.
Specification
Return Value
-
result_type
Parameters
Name | Type |
---|---|
s |
|
unreserved |
`` |
opt |
|
token |
`` |