assoc_list_get_value_of_key Subroutine

public subroutine assoc_list_get_value_of_key(a, key, value, stat)

Arguments

Type IntentOptional Attributes Name
type(assoc_list_t), intent(in) :: a
character(len=*), intent(in) :: key
character(len=*), intent(out) :: value
integer, intent(out) :: stat

Contents


Source Code

subroutine assoc_list_get_value_of_key(a,key,value,stat)
type(assoc_list_t), intent(in) :: a
character(len=*), intent(in)      :: key
character(len=*), intent(out)     :: value
integer, intent(out)              :: stat

integer :: i

do i = 1, a%nitems
   if (a%key(i) == key) then
      value = a%value(i) 
      stat = 0
      return
   endif
enddo
stat = -1
end subroutine assoc_list_get_value_of_key