I have an array which contains different blocks of data and i have to extract the blocks which contain the date and the hour. How could i do that?
string[] s={"File", "Block", "Detected:", "2010-08-11", "11:48:50", etc...}
The date and time are not always on the same position but they do have the same format
Since you know that the date and the time will be at some position inside the array, you can iterate through the array and look for something that looks like a date or a time. Example:
or, using LINQ:
For identifying the time, you could use the Regex
\d\d:\d\d:\d\d.(All code untested, since I don’t have Visual Studio available right now.)