Geekpedia Programming Tutorials






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
  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. }
Digg Digg It!     Del.icio.us Del.icio.us     Reddit Reddit     StumbleUpon StumbleIt     Newsvine Newsvine     Furl Furl     BlinkList BlinkList

Rate Rate this code snippet
Comment Current Comments
by anil mishra on Wednesday, November 25th 2009 at 03:56 AM

1
2 3 4
5 6
7 8 9

can u send me it s source code

by Dauvonn on Tuesday, December 1st 2009 at 10:15 AM

1010101000101010101010111010101101010010101011011101101010101101010100100101010101010101010101010101010010101010101010100101010010101010101010101010101010101010101001010100101010101101010101010101010101010101011101010101010101010100101010101010101001010101

by Dauvonn on Tuesday, December 1st 2009 at 10:15 AM

1010101000101010101010111010101101010010101011011101101010101101010100100101010101010101010101010101010010101010101010100101010010101010101010101010101010101010101001010100101010101101010101010101010101010101011101010101010101010100101010101010101001010101

by Dauvonn on Tuesday, December 1st 2009 at 10:15 AM

1010101000101010101010111010101101010010101011011101101010101101010100100101010101010101010101010101010010101010101010100101010010101010101010101010101010101010101001010100101010101101010101010101010101010101011101010101010101010100101010101010101001010101

by Dauvonn on Tuesday, December 1st 2009 at 10:15 AM

1010101000101010101010111010101101010010101011011101101010101101010100100101010101010101010101010101010010101010101010100101010010101010101010101010101010101010101001010100101010101101010101010101010101010101011101010101010101010100101010101010101001010101

by Dauvonn on Tuesday, December 1st 2009 at 10:15 AM

1010101000101010101010111010101101010010101011011101101010101101010100100101010101010101010101010101010010101010101010100101010010101010101010101010101010101010101001010100101010101101010101010101010101010101011101010101010101010100101010101010101001010101

by Dauvonn on Tuesday, December 1st 2009 at 10:15 AM

1010101000101010101010111010101101010010101011011101101010101101010100100101010101010101010101010101010010101010101010100101010010101010101010101010101010101010101001010100101010101101010101010101010101010101011101010101010101010100101010101010101001010101

by Dauvonn on Tuesday, December 1st 2009 at 10:15 AM

1010101000101010101010111010101101010010101011011101101010101101010100100101010101010101010101010101010010101010101010100101010010101010101010101010101010101010101001010100101010101101010101010101010101010101011101010101010101010100101010101010101001010101

by Dauvonn on Tuesday, December 1st 2009 at 10:15 AM

1010101000101010101010111010101101010010101011011101101010101101010100100101010101010101010101010101010010101010101010100101010010101010101010101010101010101010101001010100101010101101010101010101010101010101011101010101010101010100101010101010101001010101


Comment Comment on this tutorial
Name: Email:
Message:
Comment Related Source Code
There is no related code.

Comment Related Tutorials
There are no related tutorials.

Jobs C# Job Search
My skills include:

Enter a City:

Select a State:


Advanced Search >>
Latest Tech Bargains

Advertisement

Free Magazine Subscriptions

Today's Pictures

Today's Video

Other Resources

Latest Download

Latest Icons