How to search for a Substring in String array? I need to search for a Substring in the string array. The string can be located in any part of the array (element) or within
If all you need is a bool true/false answer as to whether the lineVar
exists in any of the strings in the array, use this:
arrayStrings.Any(s => s.Contains(lineVar));
If you need an index, that's a bit trickier, as it can occur in multiple items of the array. If you aren't looking for a bool, can you explain what you need?