count_values Function

private elemental function count_values(self, option_name, delimiter) result(Nv)

Get the number of values of option into section data.

Arguments

TypeIntentOptionalAttributesName
class(section), intent(in) :: self

Section data.

character, intent(in) :: option_name

Option name.

character, intent(in), optional :: delimiter

Delimiter used for separating values.

Return Value integer(kind=I4P)

Number of values.


Contents

Source Code


Source Code

  elemental function count_values(self, option_name, delimiter) result(Nv)
  !< Get the number of values of option into section data.
  class(section), intent(in)           :: self        !< Section data.
  character(*),   intent(in)           :: option_name !< Option name.
  character(*),   intent(in), optional :: delimiter   !< Delimiter used for separating values.
  integer(I4P)                         :: Nv          !< Number of values.
  character(len=:), allocatable        :: dlm         !< Dummy string for delimiter handling.
  integer(I4P)                         :: o           !< Counter.

  if (allocated(self%options)) then
    dlm = ' ' ; if (present(delimiter)) dlm = delimiter
    do o=1, size(self%options, dim=1)
      if (self%options(o) == trim(adjustl(option_name))) then
        Nv = self%options(o)%count_values(delimiter=dlm)
        exit
      endif
    enddo
  endif
  endfunction count_values