IACHAR

Function Type:

Iachar is a CHARACTER intrinsic function.

Function Purpose:

This function takes a character and will return the integer value corresponding to its location in ASCII character set.

Required Arguments:

iachar ( string )

Where string is a single character encapsulated in single quotes or a character variable containing a single character. ( this also means you can't have a character variable that has a bunch of spaces trailing a single character ). Note: The function iachar must output its results to an integer variable.

Results:

If you had a program that contained the following lines of code:
		L = iachar('b')
		J = iachar('B')
		M = iachar('~')

The variables L, J, and M would have the following values respectively, 98,66, and 126. Notice that single quotes must be placed around the character. Also, be aware that the Fortran compiler may be case insensitive when it comes to variable names, but when you use this function lower and upper case letters have a different integer value associated with them. This is because upper and lower case letters hold different positions in the ASCII character set.

For more information and examples see:

lecture twenty five examples

Up one level / Home


Written by Jason Wehr : jcw142@psu.edu and Maintained by John Mahaffy : jhm@cac.psu.edu