[ Obsolete | The ECLiPSe Built-In Predicates | Reference Manual | Alphabetic Index ]

# char_int(?Char, ?Integer)

Succeeds if Integer is the ASCII code of the one-character string Char.

Char
  One-character string or variable.
Integer
  Integer (in the range 0 to 255) or variable.

### This built-in predicate is obsolete!

## Description

If Char is instantiated, converts it to its corresponding ASCII code.

If Integer is instantiated, converts it to its corresponding one-character string.

### Modes and Determinism

- char_int(+, -) is det
- char_int(-, +) is det

### Exceptions

(5) type error
  Char is instantiated, but not to a 1-character string.
(5) type error
  Integer is instantiated, but not to an integer.
(6) out of range
  Integer is instantiated to an integer outside the range 0 to 255.
(4) instantiation fault
  Neither Char nor Integer are instantiated (non-coroutine mode only).

## Examples

       Success:
       char_int("b",98).
       char_int(C,99).     (gives C="c").
       char_int("a",I).    (gives I=97).
       Fail:
       char_int("a",98).
       Error:
       char_int(C,I).       (Error 4).
       char_int("ab",I).    (Error 5).
       char_int('a',I).     (Error 5).
       char_int(C,'30').    (Error 5).
       char_int(C,128).     (Error 6).

## See Also

char_code / 2, get_char / 1, get_char / 2, put_char / 1, put_char / 2, string_list / 2, string_list / 3