Lahey/Fujitsu Fortran

IACHAR Function

Description

The IACHAR function returns the position of a character in the ASCII collating sequence.

Syntax

IACHAR (c)

Arguments

c is an INTENT(IN) scalar or array of type CHARACTER. c must have a length of one.

Result

The result is of type default INTEGER. Its value is the position of c in the ASCII collating sequence. It is in the range 0 ≤ iachar(c) ≤ 127 .

If c is an array, the result is an array of integer values with the same shape as c.

Example

character(len=1) :: c1='A',c3(3)=(/"a","b","c"/) write(*,*) iachar(c1) ! writes 65 write(*,*) iachar(c3) ! writes 97 98 99

See Also

ASCII Character Set