fdoc

functionword_lengthpureprivate

pure integer function word_length(text)

Length of the first blank-separated word of text.

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)in

the text

Result

NameTypeAttributesDescription
word_lengthinteger

Source

Show the code
pure integer function word_length(text)
    character(len=*), intent(in) :: text    !! the text
    integer :: a, b
    a = verify(text//'x', ' ')
    b = index(text(min(a, len(text) + 1):)//' ', ' ')
    word_length = b - 1
end function word_length