How to sort a string in descending order with C#

1 Answer

0 votes
using System;
using System.Linq;
 
class Program
{
    static void Main() {
        string s = "c# c java python c++";
         
        s = String.Concat(s.OrderByDescending(ch => ch));
         
        Console.WriteLine(s);
    }
}
 
 
 
/*
run:
 
yvtponjhcccaa++#  
 
*/

 



answered Mar 27, 2021 by avibootz

Related questions

1 answer 172 views
1 answer 134 views
1 answer 141 views
2 answers 258 views
2 answers 192 views
1 answer 134 views
...