Get the number of values of option into section data.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_ini), | intent(in) | :: | self | File data. |
||
character, | intent(in), | optional | :: | delimiter | Delimiter used for separating values. |
|
character, | intent(in) | :: | section_name | Section name. |
||
character, | intent(in) | :: | option_name | Option name. |
Number of values.
elemental function count_values(self, delimiter, section_name, option_name) result(Nv)
!< Get the number of values of option into section data.
class(file_ini), intent(in) :: self !< File data.
character(*), optional, intent(in) :: delimiter !< Delimiter used for separating values.
character(*), intent(in) :: section_name !< Section name.
character(*), intent(in) :: option_name !< Option name.
integer(I4P) :: Nv !< Number of values.
character(len=:), allocatable :: dlm !< Dummy string for delimiter handling.
integer(I4P) :: s !< Counter.
if (allocated(self%sections)) then
dlm = ' ' ; if (present(delimiter)) dlm = delimiter
do s=1, size(self%sections, dim=1)
if (self%sections(s) == trim(adjustl(section_name))) then
Nv = self%sections(s)%count_values(delimiter=dlm, option_name=option_name)
exit
endif
enddo
endif
endfunction count_values