ContainsAny
ContainsAny[e1,e2]
yields True if e1 contains any of the elements of e2.
ContainsAny[e2]
is an operator form that yields True when the object to which it is applied contains any of the elements in e2.
Examples
open allclose allBasic Examples (2)
Scope (5)
Take a random integer between 0 and 1000:
Check whether it contains any even digit:
Use ContainsAny in operator form:
Find tunnels in several countries:
Find the movies directed by Steven Spielberg whose cast includes any of the actors in the given list:
ContainsAny works with associations:
Options (2)
SameTest (2)
By default, ContainsAny considers elements to be the same if they are identical:
Changes of units are taken into account, as long as they represent the exact same quantity:
Numerical approximations are not considered as the same object:
Use Equal as the comparison function to have numerical tolerance:
Applications (1)
Properties & Relations (6)
ContainsAny[list1,list2] is equivalent to testing for nonempty intersection of the lists:
ContainsAny[list1,list2] is equivalent to IntersectingQ[list1,list2]:
ContainsAny is a symmetric function of its arguments. That is, ContainsAny[list1,list2]==ContainsAny[list2,list1]:
Negation of ContainsAny[list1,list2] is equivalent to ContainsNone[list1,list2]:
ContainsAny[list,{}] always returns False:
When working with lists of strings, there is case sensitivity:
Text
Wolfram Research (2015), ContainsAny, Wolfram Language function, https://reference.wolfram.com/language/ref/ContainsAny.html.
CMS
Wolfram Language. 2015. "ContainsAny." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ContainsAny.html.
APA
Wolfram Language. (2015). ContainsAny. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ContainsAny.html