How to check if the first part of string end with specific substring in C#

1 Answer

0 votes
using System;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = "http://www.collectivesolver.com/";

            if (s.EndsWith(".com") || s.EndsWith(".co"))
                Console.WriteLine("yes");
            else
                Console.WriteLine("yes");
        }
    }
}


/*
run:
     
yes
 
*/

 



answered Dec 23, 2016 by avibootz

Related questions

1 answer 160 views
1 answer 141 views
3 answers 283 views
2 answers 270 views
...