len_trim(3f) - [FORTRAN:INTRINSIC:CHARACTER] Length of a character entity without trailing blank characters
result = len_trim(string [, kind])
Returns the length of a character string, ignoring any trailing blanks.
STRING Shall be a scalar of type CHARACTER, with intent(in) KIND (Optional) An INTEGER initialization expression indicating the kind parameter of the result.
The return value is of type INTEGER and of kind KIND. If KIND is absent, the return value is of default integer kind.
[[Fortran 95]] and later, with KIND argument [[Fortran 2003]] and later
[[Elemental procedure|Elemental function]]
Sample program
program demo_len_trim implicit none character(len=:),allocatable :: string string= how long is this string? write(*,*)LENGTH=,len(string) write(*,*)TRIMMED LENGTH=,len_trim(string) end program demo_len_trim
Functions that perform operations on character strings, return lengths of arguments, and search for certain arguments:
Elemental: adjustl(3), adjustr(3), index(3), len_trim(3), scan(3), verify(3) Nonelemental: repeat(3), trim(3)
len_trim (3) | March 11, 2021 |