third_word Function

private pure function third_word(line) result(w)

Return third blank-separated word of header line, blank if none.

Not read list-directed, which would end unit at a /.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: line

Header line.

Return Value character(len=len)


Source Code

   pure function third_word(line) result(w)
      !! Return third blank-separated word of header line, blank if none.
      !!
      !! Not read list-directed, which would end unit at a `/`.
      ! Arguments
      character(len=*), intent(in) :: line
         !! Header line.
      character(len=len(line)) :: w
      integer(int32) :: k, p
      w = adjustl(line)
      do k = 1, 2
         p = index(trim(w), ' ')
         if (p == 0) then
            w = ''
            return
         end if
         w = adjustl(w(p:))
      end do
      p = index(w, ' ')
      if (p > 0) w = w(1:p - 1)
   end function third_word