[ Strings and Atoms | The ECLiPSe Built-In Predicates | Reference Manual | Alphabetic Index ]

# atom_string(?Atom, ?String)

Conversion between an atom and a string.

Atom
  Atom or variable.
String
  String or variable.

## Description

If Atom is instantiated, converts it to a string String.

If String is instantiated, converts it to an atom Atom.

### Modes and Determinism

- atom_string(+, -) is det
- atom_string(-, +) is det

### Exceptions

(5) type error
  Atom is instantiated, but not to an atom.
(5) type error
  String is instantiated, but not to a string.
(4) instantiation fault
  Neither Atom nor String are instantiated (non-coroutine mode only).

## Examples

       Success:
       atom_string('Tom',"Tom").
       atom_string(tom,X).                 (gives X="tom").
       atom_string(X,"4").                 (gives X='4').
       Fail:
       atom_string('jo',"joe").
       Error:
       atom_string(X,Y).                   (Error 4).
       atom_string(4,"4").                 (Error 5).
       atom_string(tom,'tom').             (Error 5).

## See Also

append_strings / 3, integer_atom / 2, term_string / 2