len

Date:

10-12-2011

NAME

LEN - Determines the length of a character string

SYNOPSIS

LEN ([STRING=]string,[KIND=]kind)

IMPLEMENTATION

Cray Linux Environment (CLE)

STANDARDS

Fortran

DESCRIPTION

The LEN intrinsic function takes Fortran character string arguments and returns an integer length. This function accepts the following argument:

string

Must be of type character. It can be scalar or array valued.

kind

Determines the kind type parameter of the return result. This argument must be a scalar integer-initialization expression. See the RETURN VALUES section for more information.

LEN is an inquiry function. The name of this intrinsic can be passed as an argument.

RETURN VALUES

The result type, type parameter, and shape are default integer scalar.

The result is of type INTEGER, and its kind type parameter is dependent on the kind argument. If the kind argument is not passed, the kind type parameter of result is the same as that of the default integer type; otherwise, it is of the kind type parameter specified by the kind argument.

The result has a value equal to the number of characters in string if it is a scalar or in an element of string if it is array valued.

EXAMPLES

The following program returns the length of the character string I=37:

PROGRAM LENTEST
I=LEN('|...+....1....+....2....+....3....+..')
PRINT *,I
STOP
END