Lahey/Fujitsu Fortran

CHAR Function

Description

The CHAR function returns a character from a specified character set.

Syntax

CHAR (i [, kind] )

Required Arguments

i is an INTENT(IN) scalar or array of type INTEGER. Each i value must be positive and not greater than the number of characters in the collating sequence of the character set specified by kind

Optional Arguments

kind is INTENT(IN) and determines which character set is chosen. It must be a scalar INTEGER expression that can be evaluated at compile time. Only the ASCII character set is supported, with a kind number of 1. See ASCII Character Set

Result

The result is a CHARACTER value of length one corresponding to the ith character of the given character set.

If kind is present, the resulting kind is specified by kind. Only the default kind is supported.

If kind is absent, the kind is of type default CHARACTER.

Example

integer,dimension(6) :: i=(/72,111,119,100,121,33/) write(*,*) char(i) ! writes "Howdy!"

See Also

ASCII Character Set