September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -1,22 +0,0 @@
|
|||
:- object(spliting).
|
||||
|
||||
:- public(convert/2).
|
||||
:- mode(convert(+atom, -atom), one).
|
||||
|
||||
convert(StringIn, StringOut) :-
|
||||
atom_chars(StringIn, CharactersIn),
|
||||
phrase(split(',', Tokens), CharactersIn),
|
||||
phrase(split('.', Tokens), CharactersOut),
|
||||
atom_chars(StringOut, CharactersOut).
|
||||
|
||||
split(Separator, [t([Character| Characters])| Tokens]) -->
|
||||
[Character], {Character \== Separator}, split(Separator, [t(Characters)| Tokens]).
|
||||
split(Separator, [t([])| Tokens]) -->
|
||||
[Separator], split(Separator, Tokens).
|
||||
split(_, [t([])]) -->
|
||||
[].
|
||||
% the look-ahead in the next rule prevents adding a spurious separator at the end
|
||||
split(_, []), [Character] -->
|
||||
[Character].
|
||||
|
||||
:- end_object.
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
| ?- spliting::convert('Hello,How,Are,You,Today', Converted).
|
||||
Converted = 'Hello.How.Are.You.Today'
|
||||
yes
|
||||
Loading…
Add table
Add a link
Reference in a new issue