Quantcast
Viewing all articles
Browse latest Browse all 188

StringContainsQ And

I'm looking to test whether a string contains all substrings in it, independent of each substrings location.For example:

StringContainsQ[{"abcd", "cdab", "acdb", "abdc"}, "ab" ~~ ___ ~~ "cd"]

Results in:

{True, False, False, False}

But what I'm looking for would be:

{True, True, False, False}

However, something like:

StringContainsQ[{"abcd", "cdab", "acdb", "abdc"}, "ab"&&"cd"]

Results in errors. Any suggestions?


Viewing all articles
Browse latest Browse all 188

Trending Articles