I have a list of strings in example:
['xxx', 'xxxyy', 'ccccy']
and a normal string i.e. String example1 = "xxxyyy"
And I want to check if any of the strings in my list matches start of my example1 I dont need to know which strings match but only if example1 starts with any of the strings in the list.
CodePudding user response:
You can use LINQ for that like this:
if (yourArray.Any(a => example1.StartsWith(a))