c# - Parse Abnormal Date Run to List<DateTime> -
If I have a short short and comma separated date string:
July 23, 30, August 06, 13, 20, 27 or July 1, 15, 30, 14 August, 26,
What would be a great way to pick and replace it What is the list of times?
You can do this and with a bit of links:
< Code> var input = "July 23, 30, 06, August 13, 20, 27"; Var dates = (matches from reg.x to matrix), matts (input, @ "(\ w +) (?: [\s,] + (\ d +)) +") in M. Groups, with Capture C [2] Str = m.Groups [1]. Value + "+ +" c.Value DateTime.ParseExact (str, "MMM dd", null)) .Oolist ();
Note that if there is an invalid date, then it will throw an error.
Comments
Post a Comment