Guest User

Untitled

a guest
Apr 22nd, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. var months = new Dictionary<string, string>{
  2. {"jan", "января"},
  3. {"feb", "февраля"},
  4. {"mar", "марта"},
  5. {"apr", "апреля"},
  6. {"may", "мая"},
  7. {"jun", "июня"},
  8. {"jul", "июля"},
  9. {"aug", "августа"},
  10. {"sep", "сентября"},
  11. {"oct", "октября"},
  12. {"nov", "ноября"},
  13. {"dec", "декабря"}
  14. };
  15.  
  16. string input = "21Sep2017";
  17. string pattern = @"(d+)(D+)(d+)";
  18. var match = Regex.Match(input, pattern);
  19. var day = match.Groups[1].Value.TrimStart('0');
  20. var month = months[match.Groups[2].Value.ToLower()];
  21. var year = match.Groups[3].Value;
  22.  
  23. Console.WriteLine($"{day} {month} {year}");
Add Comment
Please, Sign In to add comment