fdoc

subroutinesplit_chunksprivate

subroutine split_chunks(text, chunks)

Split text at blank lines, as text.split('\n\n') does.

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)in

the text

chunkstype(string_t)outallocatabledimension(:)

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

Graphs

Calls

Called by