ContainsAll
Check whether the specified string contains an array of strings for each.
Source
public static bool ContainsAll(
this string value,
params string[] values)
{
foreach (string one in values)
{
if (!value.Contains(one))
{
return false;
}
}
return true;
}
Example
string value = "Kevin from Taiwan.";
string[] values = new string[] { "Kevin", "Taiwan" };
if(value.ContainsAll(values))
{
Console.WriteLine("Hi Kevin, we love Taiwan!");
}