fork(1) 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. public static void Main()
  10. {
  11. var input = "dbo.xyx.v1.UserDefinedFunction";
  12. string[] tokens = input.Split('.');
  13. int midIndex = (tokens.Length - 1) / 2;
  14. IEnumerable<int> intermediateIndices = midIndex % 2 == 0
  15. ? new[] { midIndex }
  16. : new[] { midIndex, midIndex + 1 };
  17. string intermediate = string.Join(".", tokens.Where((t, i) => intermediateIndices.Contains(i)).ToArray());
  18. Console.Write(intermediate);
  19. }
  20. }
Success #stdin #stdout 0.03s 33960KB
stdin
Standard input is empty
stdout
xyx.v1