subroutineloose_detabprivate
subroutine loose_detab(block, level, out)
Remove level indents from each line of block that has them.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| block | character(len=*) | in | the chunk | |
| level | integer | in | how many indents | |
| out | character(len=:) | out | allocatable | 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