How to check whether a string ends with another string in C#

1 Answer

0 votes
using System;

class Program
{
    static void Main() {
        string s = "java c php python c#";
 
        if (s.EndsWith("c#"))
            Console.WriteLine("yes");
        else
            Console.WriteLine("no");
    }
}
 
 
 
 
/*
run:
 
yes
 
*/

 



answered Nov 16, 2019 by avibootz

Related questions

1 answer 258 views
3 answers 422 views
1 answer 275 views
3 answers 338 views
1 answer 273 views
1 answer 230 views
...