fork download
  1. using System;
  2. using System.Globalization;
  3. using System.Linq;
  4. using System.Collections.Generic;
  5.  
  6. public class Test
  7. {
  8.  
  9.  
  10. public static void Main()
  11. {
  12. var strings = @"xxxRed
  13. xxxYellow
  14. xxxxCareful with that axe Eugene!
  15. xxxxxxdedicum aceasta frumoasa Melodia
  16. xxxxLeaders
  17. xxxxWorking Around - titles
  18. XXXXXNothing To Fear
  19. xxxxAvoiding standards
  20. xxxFirst Aid";
  21. List<string> lstTitles = strings.Split(new[]{Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries).ToList();
  22. Console.WriteLine("Before:");
  23. foreach(var str in lstTitles)
  24. Console.WriteLine(str);
  25. lstTitles.RemoveAll(s => s.TrimStart().StartsWith("x", StringComparison.OrdinalIgnoreCase));
  26. Console.WriteLine("------------------------");
  27. Console.WriteLine("After:");
  28. foreach(var str in lstTitles)
  29. Console.WriteLine(str);
  30. }
  31. }
Success #stdin #stdout 0.06s 34104KB
stdin
Standard input is empty
stdout
Before:
xxxRed
xxxYellow
xxxxCareful with that axe Eugene!
xxxxxxdedicum aceasta frumoasa Melodia
xxxxLeaders
xxxxWorking Around - titles
XXXXXNothing To Fear
xxxxAvoiding standards
xxxFirst Aid
------------------------
After: