Next: , Previous: , Up: ref-lte   [Contents][Index]


4.8.5 Atom Operations

To compute Length, the number of characters of the atom Atom, use:

?- atom_length(Atom,Length).

To concatenate Atom1 with Atom2 giving Atom12, use the following. The predicate can also be used to split a given Atom12 into two unknown parts:

?- atom_concat(Atom1,Atom2,Atom12).

To extract a sub-atom SubAtom from Atom, such that the number of characters preceding SubAtom is Before, the number of characters after SubAtom is After, and the length of SubAtom is Length, use the following. Only Atom needs to be instantiated:

?- sub_atom(Atom,Before,Length,After,SubAtom).

Send feedback on this subject.