fork(2) download
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4. using System.IO;
  5.  
  6. public class Test
  7. {
  8.  
  9. public static void Main()
  10. {
  11. string[] fileNames = new[]{"teext_023.ext", "txtxt.x9.08.ext", "text0911.ext"};
  12. List<string> versions = fileNames
  13. .Select(fileName =>
  14. Path.GetFileNameWithoutExtension(fileName).Split('_')
  15. .Last()
  16. .Reverse()
  17. .TakeWhile(c => c == '.' || Char.IsDigit(c))
  18. .Reverse()
  19. ).Select(chars => new string(chars.ToArray())).ToList();
  20. foreach(var strVersion in versions)
  21. Console.WriteLine(strVersion);
  22. }
  23. }
Success #stdin #stdout 0.03s 33896KB
stdin
Standard input is empty
stdout
023
9.08
0911