Lahey/Fujitsu Fortran

ICHAR Function

Description

The ICHAR function returns the position of a character in the collating sequence associated with the kind of the character. The only character set supported is the ASCII character set, with a kind number of 1, containing 127 characters.

Syntax

ICHAR (c)

Arguments

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

Result

The result is of type default INTEGER. Its value is the position of c in the collating sequence associated with the kind of c and is in the range 0 ≤ ichar(c) ≤ n , where n is the number of characters in the collating sequence.

Example

character(len=1) :: c(6)=(/"H","o","w","d","y","!"/) write(*,*) ichar(c) ! writes 72 111 119 100 121 33

Also

ASCII Character Set