I have variable1 with strings such as "asdfsad What do you do", "qwer What is your name", "Zebra"
And variable2 with strings "asdfsad", "qwer", "Animal"
I want to remove the first word from the strings in variable1 if it equals the word in variable2. The only thing I can come up with so far is to replace each word separately:
i.e. variable1=tranwrd(variable1, "asdfsad", ""); etc. however I have many words to replace.
Many thanks for your help.
How about something like this:
This will work for matching on the entire first word. It leaves the spaces or other punctuation in the remaining text but you should be able to change that easily if you like.
If your problem is to match character-by-character and not on the entire first word then that would be a very different question and I would recommend posting a new question.