CHAR

Elemental Intrinsic Function (Generic): Returns the character in the specified position of the processor's character set. It is the inverse of the function ICHAR.

Syntax

result = CHAR (i [, kind])

i
(Input) Must be of type integer with a value in the range 0 to n - 1, where n is the number of characters in the processor's character set.

kind
(Input; optional) Must be a scalar integer initialization expression.

Results

The result is of type character with length 1. If kind is present, the kind parameter of the result is that specified by kind; otherwise, the kind parameter of the result is that of default character. If the processor cannot represent the result value in the kind of the result, the result is undefined.

The result is the character in position i of the processor's character set. ICHAR(CHAR (i, kind(c))) has the value I for 0 to n - 1 and CHAR(ICHAR(c), kind(c)) has the value c for any character c capable of representation in the processor.

Specific Name Argument Type Result Type
  INTEGER(1) CHARACTER
  INTEGER(2) CHARACTER
CHAR 1 INTEGER(4) CHARACTER
  INTEGER(8) CHARACTER
1 This specific function cannot be passed as an actual argument.

See Also

ACHAR, IACHAR, ICHAR, Character and Key Code Charts

Examples

CHAR (76) has the value 'L'.

CHAR (94) has the value '^'.