Previous Up Next

4.8  String processing

ECLiPSe (unlike many Prolog systems) provides a string data type and the corresponding string manipulation predicates, e.g. string_length/2, concat_string/2, split_string/4, substring/4, and conversion from and to other data types, e.g. string_list/2, atom_string/2, number_string/2, term_string/2.

?- string_length("hello", N).
N = 5
Yes (0.00s cpu)
?- concat_string([abc, 34, d], S).
S = "abc34d"
Yes (0.00s cpu)
?- string_list("hello", L).
L = [104, 101, 108, 108, 111]
Yes (0.00s cpu)
?- term_string(foo(3, bar), S).
S = "foo(3, bar)"
Yes (0.00s cpu)

Previous Up Next