functionfirst_wordpureprivate
pure character(len=merge(len(text),index(text,'')-1,index(text,'')==0)) function first_word(text) result(word)
The part of text before its first blank.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| text | character(len=*) | in | the text |
Result
| Name | Type | Attributes | Description |
|---|---|---|---|
| word | character(len=merge(len(text),index(text,'')-1,index(text,'')==0)) | private |
Source
Show the code
pure function first_word(text) result(word)
character(len=*), intent(in) :: text !! the text
character(len=merge(len(text), index(text, ' ') - 1, index(text, ' ') == 0)) :: word
word = text
end function first_word