String Ends With Values in Array of Strings
This simple method checks if a string ends with either of the values in an array of characters, and returns true if it does. Useful to add appropriate suffixes to words in standard form.
|
On Saturday, August 1st 2009 at 12:25 PM By Andrew Pociu (View Profile)
    (Rated 3.8 with 6 votes) |
Contextual Ads
More C# Resources
Advertisement
public static bool EndsIn(this string o, string[] c)
{
foreach (string i in c) // Loop through the possible endings
{
if (o.EndsWith(i)) // If any matches
return true; // Return true
}
return false;
}
|
Digg It!
Del.icio.us
Reddit
StumbleIt
Newsvine
Furl
BlinkList
|
|
Rate this code snippet
Current Comments
|
Related Source Code
There is no related code.
Related Tutorials
There are no related tutorials.
C# Job Search
|