functionend_of_linepureprivate
pure integer function end_of_line(text, from) result(at)
The position of the end of the line with position from: of its newline, or after the last line.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| text | character(len=*) | in | the text | |
| from | integer | in | a position |
Result
| Name | Type | Attributes | Description |
|---|---|---|---|
| at | integer |
Source
Show the code
pure integer function end_of_line(text, from) result(at)
character(len=*), intent(in) :: text !! the text
integer, intent(in) :: from !! a position
integer :: found
found = index(text(from:), NL)
at = merge(from + found - 1, len(text) + 1, found > 0)
end function end_of_line