Get the number of values of option into section data.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(section), | intent(in) | :: | self | Section data. |
||
character, | intent(in) | :: | option_name | Option name. |
||
character, | intent(in), | optional | :: | delimiter | Delimiter used for separating values. |
Number of values.
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