subroutinesplit_chunksprivate
subroutine split_chunks(text, chunks)
Split text at blank lines, as text.split('\n\n') does.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| text | character(len=*) | in | the text | |
| chunks | type(string_t) | out | allocatabledimension(:) | the chunks |
Calls
Source
Show the code
subroutine split_chunks(text, chunks)
character(len=*), intent(in) :: text !! the text
type(string_t), allocatable, intent(out) :: chunks(:) !! the chunks
integer :: start, at
allocate (chunks(0))
start = 1
do
at = index(text(start:), NL//NL)
if (at == 0) exit
call push(chunks, text(start:start + at - 2))
start = start + at + 1
end do
call push(chunks, text(start:))
end subroutine split_chunks