count_values Function

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

Get the number of values of option data.

Arguments

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

Option data.

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, delimiter) result(Nv)
  !< Get the number of values of option data.
  class(option), intent(in)           :: self      !< Option data.
  character(*),  intent(in), optional :: delimiter !< Delimiter used for separating values.
  character(len=:), allocatable       :: dlm       !< Dummy string for delimiter handling.
  integer(I4P)                        :: Nv        !< Number of values.

  if (self%ovals%is_allocated()) then
    dlm = ' ' ; if (present(delimiter)) dlm = delimiter
    Nv = self%ovals%count(dlm) + 1
  else
    Nv = 0
  endif
  endfunction count_values