subroutinededentcommon
subroutine dedent(lines)
Remove the leading whitespace that all non-blank lines of lines share.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| lines | type(string_t) | inout | dimension(:) | the lines |
Source
Show the code
subroutine dedent(lines)
type(string_t), intent(inout) :: lines(:) !! the lines
integer :: k, common, at
common = huge(common)
do k = 1, size(lines)
at = verify(lines(k)%s, ' '//achar(9))
if (at > 0) common = min(common, at - 1)
end do
if (common == 0 .or. common == huge(common)) return
do k = 1, size(lines)
if (verify(lines(k)%s, ' '//achar(9)) == 0) then
lines(k)%s = ''
else
lines(k)%s = lines(k)%s(common + 1:)
end if
end do
end subroutine dedent