Use an extension method:
public static bool ContainsAny(this string self, params string[] criteria)
{
foreach (string s in criteria)
{
if (self.Contains(s))
{
return true;
}
}
return false;
}
call it like this:
if (myString.ContainsAny("UCK", "SAN", "AVB", "AVM", "SDS", "DWW", "WQP", "LHG"))
{
mySecondString = "CATEGORY A";
}
else if (myString.ContainsAny("UCT", "SAM", "AHJB", "AVR"))
{
mySecondString = "CATEGORY B";
}
else if (myString.ContainsAny("UKC", "SHZ", "EEB"))
{
mySecondString = "CATEGORY C";
}
else
{
mySecondString = "CATEGORY D";
}