Hi all!!
The below are the set of log data found in text file
**********************************************************************************
**2008/04/06** 00:35:35 193111 1008 O 9448050132# 74
**2008/04/06** 00:35:35 193116 1009 O 9448050132# 74
**12/15/2008** 8:36AM 106 01 090788573 00:01'23" ..06
**10/10/2008** 14:32:32 4400 4653 00:00:56 26656 0 0 OG AL#
& 0000 0000
N 124 00 8630 T001045 **10/16** 05:04 00:01:02 A 34439242360098
***************************************************************************************
I need to extract only date details(may be 200/04/06 or 10/16) from all of the above lines and display it in textbox.
I know how to segregate date if the data is ordered like below
***************************************************************************************
10/10/2008 14:32:32 4400 4653 00:00:56 26656 0 0 OG AL#
10/10/2008 14:33:29 4400 4653 00:00:02 26656434 0 0 OG LL#
10/10/2008 14:33:31 4400 4653 00:00:11 26656434 0 0 OG LL#
***************************************************************************************
The code for it is:
StreamReader rr = File.OpenText("C:/1.txt");
string input = null;
while ((input = rr.ReadLine()) != null)
{
char[] seps = { ' ' };
string[] sd = input.Split(seps, StringSplitOptions.RemoveEmptyEntries);
string[] l = new string[1000];
for (int i = 0; i < sd.Length; i++)
{
l[i] = sd[i];
textBox4.AppendText(l[i] + "\r\n");
//The date is 10 characters in length. ex:06/08/2008
if (l[i].Length == 10)
textBox1.AppendText(l[i]+"\r\n");
//The time is of 8 characters in length. ex:00:04:09
if (l[i].Length == 8)
textBox2.AppendText(l[i] + "\r\n");
//The phone is of 11 characters in length. ex:9480455302#
if (l[i].Length == 11)
textBox3.AppendText(l[i] + "\r\n");
}
}
Can you please help me with this!!!!