# 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

Parent topic: T to Z

## See Also

LEN_TRIM