The TRIM function omits trailing blanks from a character argument.
Syntax
TRIM (string)
string is an INTENT(IN) scalar of type CHARACTER.
The result is of the same type and kind as string. Its value and length are those of string with trailing blanks removed.
Example
character(len=10) :: c="Howdy! " write(*,*) len(c) ! writes 10 write(*,*) c,'end' ! writes Howdy! end write(*,*) len(trim(c)) ! writes 6 write(*,*) trim(c),'end' ! writes Howdy!end