A fixed-length character variable pads short values with blanks. len_trim returns the logical length.

Program

Play the program to store Ada in a length-20 buffer and read its trimmed length.

character_strings.f90
program character_strings
    implicit none
    character(len=20) :: name
    integer :: name_length
    name = "Ada"
    name_length = len_trim(name)
    print '(I0)', name_length
end program character_strings
fixed-length `character(len=20)` always stores exactly 20 characters.
padding Shorter values are padded with trailing blanks.
len_trim `len_trim` returns the position of the last non-blank.