functionfold_positionpureprivate
pure integer function fold_position(line, first, last) result(at)
Where to end the part of line after first, at most at last. Positions count from 0.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| line | character(len=*) | in | the line | |
| first | integer | in | where the part starts | |
| last | integer | in | where it could end |
Result
| Name | Type | Attributes | Description |
|---|---|---|---|
| at | integer |
Source
Show the code
pure integer function fold_position(line, first, last) result(at)
character(len=*), intent(in) :: line !! the line
integer, intent(in) :: first !! where the part starts
integer, intent(in) :: last !! where it could end
integer :: blank
at = last
blank = index(line(first + 1:last), ' ', back=.true.)
if (blank == 0) return
blank = first + blank - 1
if (blank >= first + (2*(last - first))/3) at = blank
end function fold_position