fdoc

subroutineloose_detabprivate

subroutine loose_detab(block, level, out)

Remove level indents from each line of block that has them.

Arguments

NameTypeIntentAttributesDescription
blockcharacter(len=*)in

the chunk

levelintegerin

how many indents

outcharacter(len=:)outallocatable

the result

Calls

Source

Show the code
subroutine loose_detab(block, level, out)
    character(len=*), intent(in) :: block               !! the chunk
    integer, intent(in) :: level                        !! how many indents
    character(len=:), allocatable, intent(out) :: out   !! the result
    type(string_t), allocatable :: lines(:)
    integer :: k, width

    lines = split_on(block, NL)
    width = 4*level
    do k = 1, size(lines)
        if (width > 0 .and. starts_with(lines(k)%s, repeat(' ', width))) lines(k)%s = lines(k)%s(width + 1:)
    end do
    out = join(lines, NL)
end subroutine loose_detab

Graphs

Calls

Called by