Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 7/13/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

TRIM

Transformational Intrinsic Function (Generic): Returns the argument with trailing blanks removed.

result = TRIM (string)

string

(Input) Must be a scalar of type character.

Results

The result is of type character with the same kind parameter as string. Its length is the length of string minus the number of trailing blanks in string.

The value of the result is the same as string, except any trailing blanks are removed. If string contains only blank characters, the result has zero length.

Example

TRIM (' NAME ') has the value ' NAME'.

TRIM (' C D ') has the value ' C D'.

The following shows another example:

 ! next line prints 30
 WRITE(*, *) LEN("I have blanks behind me       ")
 ! the next line prints 23
 WRITE(*,*) LEN(TRIM("I have blanks behind me       "))
 END

See Also