fdoc

functionjoinpure

pure character(len=joined_length(list,sep)) function join(list, sep) result(text)

The strings of list with sep between them.

Arguments

NameTypeIntentAttributesDescription
listtype(string_t)indimension(:)

the strings

sepcharacter(len=*)in

the separator

Result

NameTypeAttributesDescription
textcharacter(len=joined_length(list,sep))private

Source

Show the code
pure function join(list, sep) result(text)
    type(string_t), intent(in) :: list(:)   !! the strings
    character(len=*), intent(in) :: sep     !! the separator
    character(len=joined_length(list, sep)) :: text
    integer :: k, n

    n = 0
    do k = 1, size(list)
        if (k > 1) then
            text(n + 1:n + len(sep)) = sep
            n = n + len(sep)
        end if
        text(n + 1:n + len(list(k)%s)) = list(k)%s
        n = n + len(list(k)%s)
    end do
end function join

Graphs

Called by