If I have a string array:
public string[] foo = {... , "ABC123", ...};
and a variable:
string bar = "ABC123DEF456";
how can I check if bar contains "ABC123"
?
At the moment, I'm doing:
if (Array.Exists(foo, element => element == bar))
to check if the entire string bar exists in foo, but I want know if an element in foo is a substring of bar. How would I do this? Is it possible to use .Contains
?