fork download
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4. using System.Globalization;
  5. using System.Net;
  6.  
  7.  
  8. public class Test
  9. {
  10. public static void Main()
  11. {
  12. var strings = new[] {
  13. "FD1","FD5","FD10","FD102","FD105","FD10","FD32","FD80", "FD31", "FD21", "FDnon"
  14. };
  15. strings = strings.Select(str => new
  16. {
  17. str,
  18. num = str.Substring(2).All(Char.IsDigit) ? int.Parse(str.Substring(2)) : 0
  19. })
  20. .OrderBy(x => x.num)
  21. .Select(x => x.str)
  22. .ToArray();
  23.  
  24. foreach(var s in strings)
  25. Console.WriteLine(s);
  26. }
  27. }
  28.  
  29.  
  30.  
Success #stdin #stdout 0.05s 34016KB
stdin
Standard input is empty
stdout
FDnon
FD1
FD5
FD10
FD10
FD21
FD31
FD32
FD80
FD102
FD105