1:- module(bc_string, [
2 bc_string_replace/4 3]). 4
6
7:- use_module(library(error)).
14bc_string_replace(In, Search, Replacement, Out):-
15 must_be(atomic, In),
16 must_be(atomic, Search),
17 must_be(atomic, Replacement),
18 atom_string(In, InString),
19 atom_string(Search, SearchString),
20 atom_string(Replacement, ReplacementString),
21 atom_string(InAtom, InString),
22 atom_string(SearchAtom, SearchString),
23 atomic_list_concat(Tokens, SearchAtom, InAtom),
24 atomics_to_string(Tokens, ReplacementString, Out)