len_trim

Date:

10-12-2011

NAME

LEN_TRIM - Returns the length of the character argument without counting trailing blank characters

SYNOPSIS

CHARACTER string
INTEGER kind,
length

length = LEN_TRIM ([STRING=]string, [[KIND=]kind])

IMPLEMENTATION

Cray Linux Environment (CLE)

STANDARDS

Fortran

DESCRIPTION

The LEN_TRIM intrinsic function returns the length of the character argument without counting trailing blank characters. It accepts the following arguments:

string

Must be of type character

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_TRIM is an elemental function. The name of this intrinsic cannot be passed as an argument.

RETURN VALUES

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 type is default integer. The result has a value equal to the number of characters remaining after any trailing blanks in string are removed. If the argument contains no nonblank characters, the result is 0.

EXAMPLES

LEN_TRIM(’ A B ‘) yields 4

LEN_TRIM(’ ‘) yields 0