achar(3f) - [FORTRAN:INTRINSIC:CHARACTER] returns a character in a specified position in the ASCII collating sequence
result = ACHAR(I [, KIND])
achar(I) returns the character located at position I in the ASCII collating sequence.
I the type shall be INTEGER. KIND (optional) an INTEGER initialization expression indicating the kind parameter of the result.
The return value is of type CHARACTER with a length of one. If the KIND argument is present, the return value is of the specified kind and of the default kind otherwise.
Sample program:
program demo_achar implicit none character(len=1) :: c integer,parameter :: blank=32 integer :: i c = achar(blank) write(*,(i0,1x,a,1x,b0,1x,o0,1x,z0))blank,c,c,c,c write(*,(32(a))) (achar(i),i=32,126) end program demo_acharResults:
32 100000 40 20 !"#$%&()*+,-./0123456789:;<=>? @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_ abcdefghijklmnopqrstuvwxyz{|}~
see [[ichar]] for a discussion of converting between numerical values and formatted string representations.
[[FORTRAN 77]] and later, with KIND argument Fortran 2003 and later
Elemental function
char(3), iachar(3), ichar(3)Functions that perform operations on character strings, return lengths of arguments, and search for certain arguments:
elemental: adjustl(3), adjustr(3), index(3), len_trim(3), scan(3), verify(3) nonelemental: repeat(3), trim(3)
achar (3) | March 11, 2021 |