Link to home
Start Free TrialLog in
Avatar of hidrau
hidrauFlag for Brazil

asked on

searching a string in another string

Hello guys,

I have this string:
 
A :=  'is / be / here / with / me /'

B := 'be / with / me / there'

in b, my frist word is be, the '/' is the delimiter to another word. I need to know if each word in my be is in A

the function must return me :

Total_in = 3
Total_out = 1 (there) this word is not in A
Total_missing = 2 (is / here) these words is missing in B

Thanks


 
Avatar of hidrau
hidrau
Flag of Brazil image

ASKER

sometimes I will have two or more words repeated in my list, like:

A := 'is / be / is / here'

if b only has one 'is', then it is missing another is.

I need a another string with the words missing in B

ASKER CERTIFIED SOLUTION
Avatar of Russell Libby
Russell Libby
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
guess I should explain the parameters :) they are siilar to russels parameters:
- first and second are the 2 strings
- i and o are in, and out. from your example i=3, o=1 for first case
- a and b return the "not in b" and "not in a" respectivly. (so they are inverse to what russel has) my logic was that a returns what remains in a, and b, what remains in b and the common things are deleted.
Avatar of hidrau

ASKER

Two way of doing the same task - both very interesting.

Thanks guys