TRIM (The GNU Fortran Compiler)

### 8.289 `TRIM` — Remove trailing blank characters of a string ¶

Synopsis:

  `RESULT = TRIM(STRING)`

Description:

  Removes trailing blank characters of a string.

Class:

  Transformational function

Arguments:

  STRING | Shall be a scalar of type `CHARACTER`.

Return value:

  A scalar of type `CHARACTER` that is the length of STRING less the number of trailing blanks.

Example:

      PROGRAM test_trim
        CHARACTER(len=10), PARAMETER :: s = "GFORTRAN  "
        WRITE(*,*) LEN(s), LEN(TRIM(s))  ! "10 8", with/without trailing blanks
      END PROGRAM

Standard:

  Fortran 90 and later

See also:

  `ADJUSTL` — Left adjust a string,
  `ADJUSTR` — Right adjust a string