boost::urls::params_encoded_base::get_or
Return the value for a key or a fallback
Synopsis
pct_string_view
get_or(
pct_string_view key,
pct_string_view value = {},
ignore_case_param ic = {}) const noexcept;
Description
This convenience function searches for the first parameter matching key and returns its percent‐encoded value. If no parameter with the specified key exists, the provided fallback value is returned instead. When the key is found but the corresponding parameter has no value, an empty string is returned.
Example
url_view u( "/path?first=John&last=Doe" );
assert( u.encoded_params().get_or(
"missing", "n%2Fa" ) == "n%2Fa" );
Parameters
| Name | Description |
|---|---|
key |
The key to match. |
value |
The fallback string returned when no matching key exists. If this parameter is omitted, an empty string is used. |
ic |
Optional case‐insensitive compare indicator. |
Created with MrDocs