login

Availability:built-in
[ISO]sub_atom(+Atom, ?Before, ?Len, ?After, ?Sub)
ISO predicate for breaking atoms. It maintains the following relation: Sub is a sub-atom of Atom that starts at Before, has Len characters, and Atom contains After characters after the match.
?- sub_atom(abc, 1, 1, A, S).

A = 1, S = b

The implementation minimises non-determinism and creation of atoms. This is a very flexible predicate that can do search, prefix- and suffix-matching, etc.