String contains this OR that

If I have a list of strings and want to pass the String.Contains node through it but in the input SearchFor have “This” OR “That” how do I add multiple sets of strings. So if either one of them two is present in the list the result would be true and for all other cases false. I’ve tried passing through as a list, using the operator, and the logic or and logic xor but no luck?


ORlike that?

Not quite Peter in your example the results I would be after would be as in the picture.

String Contains

you really need “true” “false” or just the position in the original list?


How about this?


Andreas - how would that work if the original code block in your script contains nested lists.

It would work by cheating just a little bit :wink: (i.e. flattening and later rebuilding the nested list structure), like so (the two custom nodes from package Clockwork):


Haha a nice little cheat! Much appreciated Andreas.

Andreas, I’m trying to use this. It looks like List.SublistByLengths has been changed to List.ChopByLength. I duplicated what you have above, but expanded the original lists a little just to see what was happening. It looks like the List.ChopByLength is just repeating the first x-number of values in each list and not bringing back any of the later values. Am I missing something?

ver 1.0

1 Like

Or if you want to keep your graph as is use List.Chop instead of List.ChopByLength.


1 Like

Design Script