I would like to ask you how I could implement a function that for each string in a list execute something. This should be the case:
list={"a", "upon", "time", "once", ...}
What I am trying to do is removing from a text, example= {"once upon a time"}, those strings but one by one. This means that I should be able to check if a is in the text. If it is, then I should remove it. And so on. I would do that using a for loop in C. I am new in using Mathematica, so I hope you can help me.
Would it possible to print the results one by one (for example: example={"once upon time"}, {"once a time"}, {"once upon a"}...)?
Thank you for your time.
exampleandlist? – kglr Sep 20 '19 at 23:14Map[StringReplace[example, Alternatives @@ Complement[list, {#}] :> ""] &, list]? – kglr Sep 20 '19 at 23:33