I want to take a user's input, and check if the end of what they put in ends with something. But it's more than one string. I have it in a list. And I could check if the input ends with a string from the list one by one. However, I would just like to check if the input ends with anything from a list.
If "endings" is a List<string> that contains the possible endings to match:
if (endings.Any(x => userInput.EndsWith(x)))
{
// the string ends with something in the list
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With