[#boost-urls-params_encoded_base-get_or] = xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/params_encoded_base.adoc[params_encoded_base]::get_or :relfileprefix: ../../../ :mrdocs: Return the value for a key or a fallback == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/params_encoded_base.hpp#Lundefined[boost/url/params_encoded_base.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:boost/urls/pct_string_view.adoc[pct_string_view] get_or( xref:boost/urls/pct_string_view.adoc[pct_string_view] key, xref:boost/urls/pct_string_view.adoc[pct_string_view] value = {}, xref:boost/urls/ignore_case_param.adoc[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 [,cpp] ---- url_view u( "/path?first=John&last=Doe" ); assert( u.encoded_params().get_or( "missing", "n%2Fa" ) == "n%2Fa" ); ---- == Complexity Linear in `this‐>buffer().size()`. == Exception Safety Throws nothing. == Return Value The encoded value or the fallback. == Parameters [cols="1,4"] |=== |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. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#