Is it possible to have the contain function find if the string contains 2 words or more? This is what I\'m trying to do:
string d = \"You hit someone for 50
So you want to know if one string contains two other strings?
You could use this extension which also allows to specify the comparison:
public static bool ContainsAll(this string text, StringComparison comparison = StringComparison.CurrentCulture, params string[]parts)
{
return parts.All(p => text.IndexOf(p, comparison) > -1);
}
Use it in this way (you can also omit the StringComparison):
bool containsAll = d.ContainsAll(StringComparison.OrdinalIgnoreCase, a, b);