Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var months = new Dictionary<string, string>{
- {"jan", "января"},
- {"feb", "февраля"},
- {"mar", "марта"},
- {"apr", "апреля"},
- {"may", "мая"},
- {"jun", "июня"},
- {"jul", "июля"},
- {"aug", "августа"},
- {"sep", "сентября"},
- {"oct", "октября"},
- {"nov", "ноября"},
- {"dec", "декабря"}
- };
- string input = "21Sep2017";
- string pattern = @"(d+)(D+)(d+)";
- var match = Regex.Match(input, pattern);
- var day = match.Groups[1].Value.TrimStart('0');
- var month = months[match.Groups[2].Value.ToLower()];
- var year = match.Groups[3].Value;
- Console.WriteLine($"{day} {month} {year}");
Add Comment
Please, Sign In to add comment