SubString is a substring of String. There are Before
characters in String before SubString, SubString
contains Length character and is followed by After
characters in String. If not enough information is provided
to compute the start of the match, String is scanned
left-to-right. This predicate is functionally equivalent to sub_atom/5,
but operates on strings. The following example splits a string of the
form
<name>=<value> into the name part (an
atom) and the value (a string).
name_value(String, Name, Value) :-
sub_string(String, Before, _, After, "="), !,
sub_string(String, 0, Before, _, NameString),
atom_string(Name, NameString),
sub_string(String, _, After, 0, Value).