Manual Reference Pages  - ichar (3fortran)

NAME

ICHAR(3) - [CHARACTER:CONVERSION] Character-to-integer code conversion function

SYNOPSIS

result = ichar(c [,kind])

         elemental integer(kind=KIND) function ichar(c,KIND)

character(len=1,kind=**),intent(in) :: c integer,intent(in),optional :: KIND

CHARACTERISTICS

o C is a scalar character
o KIND is a constant integer initialization expression indicating the kind parameter of the result.
o The return value is of type integer and of kind KIND. If KIND is absent, the return value is of default integer kind.

DESCRIPTION

ICHAR(3) returns the code for the character in the system’s native character set. The correspondence between characters and their codes is not necessarily the same across different Fortran implementations. For example, a platform using EBCDIC would return different values than an ASCII platform.

See IACHAR(3) for specifically working with the ASCII character set.

OPTIONS

o C : The input character to determine the code for. Its value shall be that of a character capable of representation in the processor.
o KIND : indicates the kind parameter of the result. If KIND is absent, the return value is of default integer kind.

RESULT

The code in the system default character set for the character being queried is returned.

The result is the position of C in the processor collating sequence associated with the kind type parameter of C.

it is nonnegative and less than n, where n is the number of characters in the collating sequence.

The kind type parameter of the result shall specify an integer kind that is capable of representing n.

For any characters C and D capable of representation in the processor, C <= D is true if and only if ICHAR (C) <= ICHAR (D) is true and C == D is true if and only if ICHAR (C) == ICHAR (D) is true.

EXAMPLES

Sample program:

    program demo_ichar
    implicit none

write(*,*)ichar([’a’,’z’,’A’,’Z’])

end program demo_ichar

Results:

                 97         122          65          90

STANDARD

Fortran 95 , with KIND argument -Fortran 2003

SEE ALSO

ACHAR(3), CHAR(3), IACHAR(3)

Functions that perform operations on character strings, return lengths of arguments, and search for certain arguments:
o ELEMENTAL: ADJUSTL(3), ADJUSTR(3), INDEX(3),
SCAN(3), VERIFY(3)
o NONELEMENTAL: LEN_TRIM(3), LEN(3), REPEAT(3), TRIM(3)
fortran-lang intrinsic descriptions (license: MIT) @urbanjost


Nemo Release 3.1 ichar (3fortran) April 28, 2024
Generated by manServer 1.08 from a51faa03-5a5f-40a6-8c77-013f661e7fef using man macros.