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. string test = "1234ABCD-1A-AB";
  13. string[] parts = test.Split('-');
  14. string firstPart = parts[0];
  15. string secondPart = parts.ElementAtOrDefault(1);
  16. string thirdPart = parts.ElementAtOrDefault(2);
  17. Console.WriteLine(firstPart);
  18. Console.WriteLine(secondPart);
  19. Console.WriteLine(thirdPart);
  20. }
  21. }
Success #stdin #stdout 0.02s 33896KB
stdin
Standard input is empty
stdout
1234ABCD
1A
AB