String Ends With Values in Array of Strings

  1. public static bool EndsIn(this string o, string[] c)
  2. {
  3.     foreach (string i in c) // Loop through the possible endings
  4.     {
  5.         if (o.EndsWith(i)) // If any matches
  6.             return true; // Return true
  7.     }
  8.     return false;
  9. }


Written by