len_trim(string): Length Ignoring Trailing Blanks

Length of a character string ignoring trailing blank character(s).

Declaration

Sintaxe

retval = len_trim(string)
integer elemental function len_trim(string)

Argumentos

string the input value of character type.

Valor de retorno

The return value is of type unsigned integer.

Descrição

len_trim(string) returns the length of the character argument without including trailing blank character(s).

Tipos

Supported argument type is character scalar.

interface repeat
    module procedure repeati32, repeati64
end interface

contains

integer elemental function len_trim(string)
    character(len=*), intent(in) :: string
end function

Exemplos

program intrinsics_len_trim
    use lfortran_intrinsic_string, only: len_trim
    implicit none
    character(*), parameter :: s1 = " A B "
    integer:: retval
    retval = len_trim(s1)
    print *, retval
end program

Resultado:

4

Veja Também

lge.