adjustl

Date:

10-12-2011

NAME

ADJUSTL - Adjusts a character string to the left

SYNOPSIS

ADJUSTL ([STRING=]string)

STANDARDS

Fortran

DESCRIPTION

The ADJUSTL intrinsic function adjusts a character string to the left, removes leading blanks, and inserts trailing blanks. It accepts the following argument:

string

Must be of type character

ADJUSTL is an elemental function. The name of this intrinsic cannot be passed as an argument.

RETURN VALUES

The result is type character with the same length as string.

The value of the result is the same as string, except that any leading blanks have been deleted and the same number of trailing blanks have been inserted.

EXAMPLES

In the following examples, a carat (^) indicates a blank.

Example 1:

CHARACTER*6 VAR
VAR = ADJUSTL( '^^WORD' )
PRINT *,"VAR='", VAR,"'"

This code segment produces the following output:

VAR='WORD^^'

Example 2:

      CHARACTER*29 STRING
      STRING = '^^^TEST STRING FOR ADJUSTL^^^'
      WRITE(6,1) '>', STRING, '<'
      WRITE(6,1) '>', ADJUSTL(STRING), '<'
1     FORMAT(3A)
      END

This code returns the following output:

>^^^TEST STRING FOR ADJUSTL^^^<>TEST STRING FOR ADJUSTL^^^^^^<