|Did you know ...||Search Documentation:|
:- use_module(library(strings)).(can be autoloaded)
?- string_lines("a\nb\n", L). L = ["a", "b"]. ?- string_lines(S, ["a", "b"]). S = "a\nb\n".
This predicate is a true relation if both arguments are in canonical form, i.e. all text is represented as strings and the first argument ends with a newline. The implementation tolerates non-canonical input: other types than strings are accepted and String does not need to end with a newline.