[ Strings and Atoms | Reference Manual | Alphabetic Index ]

atomics_to_string(++List, +Glue, -String)

String is the string formed by concatenating the elements of List with an instance of Glue beween each of them.
List
List of atomic terms.
Glue
A string or atom.
String
A string or variable.

Description

String is the string formed by concatenating the elements of List with an instance of Glue beween each of them. List may contain numbers, atoms and strings. The result of the concatenation is always a string.

Note that atomics_to_string/2 can be defined as

       atomics_to_string(List, String) :-
           atomics_to_string(List, "", String).

Modes and Determinism

Exceptions

(4) instantiation fault
List is not instantiated (non-coroutine mode only).
(4) instantiation fault
List contains free variables (non-coroutine mode only).
(5) type error
List is instantiated, but not to a list of atomic terms.
(5) type error
String is neither an string nor a variable.
(5) type error
Glue is neither an string nor an atom.

Examples

Success:
    atomics_to_string([usr,"local",bin], "/", "usr/local/bin").
    atomics_to_string([1,2,3], " -> ", "1 -> 2 -> 3").

Error:
    atomics_to_string(A,"-",X).        (Error 4).
    atomics_to_string([abc,D],",",X).  (Error 4).
    atomics_to_string(art,",",X).      (Error 5).
    atomics_to_string([a,b],3,X).      (Error 5).

See Also

atomics_to_string / 2, concat_strings / 3, append_strings / 3, atom_string / 2, split_string / 4, sprintf / 3