unifies by backtracing one atom with all substrings of another atom.
sub_atom/5 unifies by backtracking SubAtom with all substrings
of Atom where
Length is the length of SubAtom,
LeftLength is the length of the substring of Atom on the
left side of SubAtom and
RightLength is the length of the substring of Atom on the
right side of SubAtom.
Atom atom LeftLength integer or an expression with substitution integer Length integer or an expression with substitution integer RightLength integer or an expression with substitution integer SubAtom atom
| sub_atom(text, LL, 3, RL, S). | Succeeds with substitutions {LL <- 0, RL <- 2, S <- 'te'} {LL <- 1, RL <- 1, S <- 'ex'} {LL <- 2, RL <- 0, S <- 'xt'} |
| sub_atom(abcabd, LL, 2, RL, ab). | Succeeds with substitutions {LL <- 0, RL <- 4} {LL <- 3, RL <- 1} |
| sub_atom(hello, 0, 3, _, Prefix). | Succeeds with substitution {Prefix <- hel} |
| sub_atom(hello, _, 3, 0, Suffix). | Succeeds with substitution {Suffix <- llo} |
| sub_atom(hello, 1, 3, _, Infix). | Succeeds with substitution {Infix <- ell} |
This predicate is part of the ISO-Prolog Standard.