fdoc

functiontop_split

type(string_t) function top_split(s, sep) result(parts)

The parts of s between the characters sep outside brackets and strings, each stripped.

Arguments

NameTypeIntentAttributesDescription
scharacter(len=*)in

the text

sepcharacter(len=1)in

the separator

Result

NameTypeAttributesDescription
partstype(string_t)privateallocatabledimension(:)

Calls

Source

Show the code
function top_split(s, sep) result(parts)
    character(len=*), intent(in) :: s   !! the text
    character, intent(in) :: sep        !! the separator
    type(string_t), allocatable :: parts(:)
    integer :: start, at

    allocate (parts(0))
    start = 1
    do
        at = top_index(s(start:), sep)
        if (at == 0) exit
        call push(parts, strip(s(start:start + at - 2)))
        start = start + at
    end do
    call push(parts, strip(s(start:)))
end function top_split

Graphs

Calls

Called by