Remove first whitespace-separated token from buf.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(inout) | :: | buf |
Text left to split. |
||
| character(len=*), | intent(out) | :: | tok |
Removed token, blank when |
subroutine pop(buf, tok) !! Remove first whitespace-separated token from `buf`. ! Arguments character(len=*), intent(inout) :: buf !! Text left to split. character(len=*), intent(out) :: tok !! Removed token, blank when `buf` is empty. integer :: p buf = adjustl(buf) p = index(buf, ' ') if (p <= 1) then tok = trim(buf); buf = '' else tok = buf(1:p - 1); buf = buf(p:) end if end subroutine pop