Given an input in a string. Something like:
Code:eliza :-
write('Hello'),nl,
read(sInput).
How can I find out if a certian word is in the sInput variable. So I can give feedback?
ØØ
Printable View
Given an input in a string. Something like:
Code:eliza :-
write('Hello'),nl,
read(sInput).
How can I find out if a certian word is in the sInput variable. So I can give feedback?
ØØ
Huh?
VB6.0 has an instr function.
If this is another language, perhaps the specific-language forum would be a better place.
or is it language-specific?
Hehehe...you are so cute...:)...I added the language in [ ], Prolog it is called, and it looks nothing like VB...:(Quote:
Originally Posted by JPicasso
Kedaman helped me on MSN. Here is the solution:
Code:%example on how to run (at the moment..:))
%atom_chars('you are an idiot',A),atom_chars('an',B),search(A,B,C).
search2([_|_],[],1).
search2([X|XS],[X|YS],N):- search2(XS,YS,N).
search([X|XS],[X|YS],N):- search2(XS,YS,N).
search([_|XS],YS,N):- search(XS,YS,N1),N is N1+1.
search([],_,0):-!,fail.
yeah, I get that a lot.Quote:
Originally Posted by NoteMe