trim_blanks Function

private pure function trim_blanks(text) result(t)

text without trailing blanks and tabs.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: text

the text to trim

Return Value character(len=:), allocatable


Called by

proc~~trim_blanks~~CalledByGraph proc~trim_blanks trim_blanks proc~emit_comment_line emit_comment_line proc~emit_comment_line->proc~trim_blanks proc~layout layout proc~layout->proc~emit_comment_line proc~format_pass format_pass proc~format_pass->proc~layout proc~format_text format_text proc~format_text->proc~format_pass proc~relayout relayout proc~format_text->proc~relayout proc~relayout->proc~format_pass proc~process_text process_text proc~process_text->proc~format_text proc~process_file process_file proc~process_file->proc~process_text proc~process_stdin process_stdin proc~process_stdin->proc~process_text proc~run run proc~run->proc~process_file proc~run->proc~process_stdin

Source Code

pure function trim_blanks(text) result(t)
    !! `text` without trailing blanks and tabs.
    character(len=*), intent(in) :: text   !! the text to trim
    character(len=:), allocatable :: t
    integer :: n
    n = len(text)
    do while (n > 0)
        if (text(n:n) /= ' ' .and. text(n:n) /= achar(9)) exit
        n = n - 1
    end do
    t = text(1:n)
end function trim_blanks