functionword_lengthpureprivate
pure integer function word_length(text)
Length of the first blank-separated word of text.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| text | character(len=*) | in | the text |
Result
| Name | Type | Attributes | Description |
|---|---|---|---|
| word_length | integer |
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