Function params_encoded_base::count

Return the number of matching keys

Synopsis

Declared in header <boost/url/params_encoded_base.hpp>

std::size_t
count(
    pct_string_view key,
    ignore_case_param ic = = {}) const noexcept;

Description

This function examines the parameters in the container to find the number of matches for the specified key, which may contain percent escapes. The comparison is performed as if all escaped characters were decoded first.

Example

assert( url_view( "?first=John&last=Doe" ).encoded_params().count( "first" ) == 1 );

Complexity

Linear in this->buffer().size().

Exception Safety

Exceptions thrown on invalid input.

Exceptions

Name Thrown on

system_error

key contains an invalid percent-encoding.

Parameters

Name Description

key

The key to match. By default, a case-sensitive comparison is used.

ic

An optional parameter. If the value ignore_case is passed here, the comparison is case-insensitive.