adjustr

Date:

10-12-2011

NAME

ADJUSTR - Adjusts a character string to the right

SYNOPSIS

ADJUSTR ([STRING=]string)

STANDARDS

Fortran

DESCRIPTION

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

string

Must be of type character

ADJUSTR 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 trailing blanks have been deleted and the same number of leading blanks have been inserted.

EXAMPLES

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

Example 1:

VAR = ADJUSTR( 'WORD^^' )
PRINT *,"VAR='", VAR,"'"

This code segment returns the following output:

VAR='^^WORD'

Example 2:

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

This code returns the following output:

>^^^TEST STRING FOR ADJUSTR^^^<>^^^^^^TEST STRING FOR ADJUSTR<