fork(1) download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. public class Program {
  6. public static void Main() {
  7. var lista = new List<string> { "12/10", "01/02", "123/12", "A/1", "4/5" };
  8. var listaClassificada = lista.OrderBy(x => ConversaoParcial(x));
  9. listaClassificada.ToList().ForEach(Console.WriteLine);
  10. }
  11. public static string ConversaoParcial(string texto) {
  12. int valor;
  13. string textoParcial = texto.Split('/', '-')[0];
  14. return int.TryParse(textoParcial, out valor) ? textoParcial.PadLeft(4, '0') : textoParcial.PadLeft(4, 'A');
  15. }
  16. }
  17.  
  18. //https://pt.stackoverflow.com/q/180975/101
Success #stdin #stdout 0.03s 18368KB
stdin
Standard input is empty
stdout
01/02
4/5
12/10
123/12
A/1