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 165 views
3 answers 245 views
1 answer 162 views
3 answers 177 views
1 answer 169 views
1 answer 134 views
...