TRIM intrinsic function
Standard: F77 F90 F95 F2003 F2008
  Example Program


STRING : scalar Character, with any kind;

Result: same type and kind as STRING.


The TRIM intrinsic function returns a “trimmed” STRING; that is, the string without trailing blanks; its length is equal to LEN_TRIM(STRING). Because character comparison ignores trailing blanks, TRIM(STRING) is always equal to STRING, but might have a different length.

Note that unlike LEN_TRIM, this is not elemental.

CHARACTER type, LEN intrinsic function, LEN_TRIM intrinsic function.