Last nonblank character
Return the last nonblank character in a string.
1
2
"foo" ⟹ "o"
"foo " ⟹ "o"
Compiled as Fortran 2008 by gfortran.
1
2
3
4
5
6
7
function last_nonblank(str)
character(*) :: str
character :: last_nonblank
integer :: strlen
strlen = len_trim(str)
last_nonblank = str(strlen:strlen)
end