[UP]


Manual Reference Pages  - len (3)

NAME

len(3f) - [FORTRAN:INTRINSIC:CHARACTER] Length of a character entity

SYNTAX

l = len(string [, kind])

DESCRIPTION

Returns the length of a character string. If STRING is an array, the length of an element of STRING is returned. Note that STRING need not be defined when this intrinsic is invoked, since only the length, not the content, of STRING is needed.

ARGUMENTS

STRING Shall be a scalar or array of type CHARACTER, with intent(in)
KIND (Optional) An INTEGER initialization expression indicating the kind parameter of the result.

RETURN VALUE

The return value is of type INTEGER and of kind KIND. If KIND is absent, the return value is of default integer kind.

STANDARD

[[FORTRAN 77]] and later, with KIND argument [[Fortran 2003]] and later

CLASS

[[Inquiry function]]

EXAMPLE

Sample program

     program demo_len
     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

SEE ALSO

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 (3) March 11, 2021
Generated by manServer 1.08 from 6826f4ff-fa26-47ef-8a2e-c114b6a8bd47 using man macros.