Please guarantee to generate (+,-,-,-,+) solutions left-most match 1st etc. (as it seems to do)
|Did you know ...||Search Documentation:|
?- sub_atom(abc, 1, 1, A, S). A = 1, S = b
The implementation minimises non-determinism and creation of atoms. This is a flexible predicate that can do search, prefix- and suffix-matching, etc.
A useful example is:
?- sub_atom('123456789', Before, Len, After, '3'). Before = 2, Len = 1, After = 6 .