pair_has_name Function

public pure function pair_has_name(pair_arr, name)

Return .true. if there exists a pair_type object inside pair_arr with a name attribute equal to the provided name; otherwise, return .false.. HTTP pairs are case-insensitive, implying that values are converted to lowercase before the comparison is performed.

Arguments

Type IntentOptional Attributes Name
type(pair_type), intent(in) :: pair_arr(:)

The array in which we want to find a pair_type instance with its name attribute equal to the given name.

character(len=*), intent(in) :: name

The name to be searched in the pair_arr.

Return Value logical


Contents

Source Code


Source Code

    pure logical function pair_has_name(pair_arr, name)
        !!> Return `.true.` if there exists a `pair_type` object inside `pair_arr` with 
        !!> a `name` attribute equal to the provided `name`; otherwise, return `.false.`. 
        !!> HTTP pairs are **case-insensitive**, implying that values are **converted to 
        !!> lowercase** before the comparison is performed.

        type(pair_type), intent(in) :: pair_arr(:)
            !! The array in which we want to find a `pair_type` instance with its 
            !! `name` attribute equal to the given `name`.
        character(*), intent(in) :: name
            !! The `name` to be searched in the `pair_arr`.
        integer :: n

        pair_has_name = .false.
        do n = 1, size(pair_arr)
            if (to_lower(name) == to_lower(pair_arr(n)%name)) then
                pair_has_name = .true.
                return
            end if
        end do

    end function pair_has_name