trim
- Date:
06-19-2023
NAME
TRIM - Returns the character argument with trailing blank characters removed
SYNOPSIS
TRIM ([STRING=]string)
STANDARDS
Fortran
DESCRIPTION
The TRIM intrinsic function removes trailing blank characters from its character argument. If the input string contains trailing blank characters, it returns the string without the trailing blanks. If the string contains only blanks, it returns a zero-length string. It accepts the following argument:
- string
Must be of type character and be a scalar
TRIM is a transformational function. The name of this intrinsic cannot be passed as an argument.
RETURN VALUES
The result is a scalar entity of type character with a length that is the length of string without any trailing blank characters. The value of the result is the same as string except that any trailing blanks have been removed. If string contains only blank characters, the result is a string of 0 length.
EXAMPLES
Consider the following example of a TRIM function reference. In this example, the carat (^) represents a blank:
CHVAR = TRIM( '^W^O^R^D^^' )
PRINT *,"CHVAR='",CHVAR,"'"
This reference returns the following result:
CHVAR='^W^O^R^D'