Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
21
Task/Substring/Logtalk/substring-1.logtalk
Normal file
21
Task/Substring/Logtalk/substring-1.logtalk
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
:- object(substring).
|
||||
|
||||
:- public(test/5).
|
||||
|
||||
test(String, N, M, Character, Substring) :-
|
||||
sub_atom(String, N, M, _, Substring1),
|
||||
write(Substring1), nl,
|
||||
sub_atom(String, N, _, 0, Substring2),
|
||||
write(Substring2), nl,
|
||||
sub_atom(String, 0, _, 1, Substring3),
|
||||
write(Substring3), nl,
|
||||
% there can be multiple occurences of the character
|
||||
once(sub_atom(String, Before4, 1, _, Character)),
|
||||
sub_atom(String, Before4, M, _, Substring4),
|
||||
write(Substring4), nl,
|
||||
% there can be multiple occurences of the substring
|
||||
once(sub_atom(String, Before5, _, _, Substring)),
|
||||
sub_atom(String, Before5, M, _, Substring5),
|
||||
write(Substring5), nl.
|
||||
|
||||
:- end_object.
|
||||
7
Task/Substring/Logtalk/substring-2.logtalk
Normal file
7
Task/Substring/Logtalk/substring-2.logtalk
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
| ?- ?- substring::test('abcdefgh', 2, 3, 'b', 'bc').
|
||||
cde
|
||||
cdefgh
|
||||
abcdefg
|
||||
bcd
|
||||
bcd
|
||||
yes
|
||||
Loading…
Add table
Add a link
Reference in a new issue