already_header Function

private function already_header(this, header) result(exists)

Type Bound

data_frame

Arguments

Type IntentOptional Attributes Name
class(data_frame), intent(in) :: this
character(len=*), intent(in) :: header

Return Value logical


Source Code

    function already_header(this, header) result(exists)
        class(data_frame), intent(in) :: this
        character(len=*), intent(in) :: header
        logical :: exists

        integer :: i
        character(len=:), allocatable :: trimmed_header

        exists = .false.
        if (.not. this % with_headers) return

        trimmed_header = trim(adjustl(header))

        do i = 1, this % num_cols
            if (trim(adjustl(this % headers(i))) == trimmed_header) then
                exists = .true.
                exit
            end if
        end do
    end function already_header