Hy my Friends 🙂
So i have a litte problem, i have a Text File with following content
This i from an email Script.
Email: usera@hotmail.com
Status: done
Lang: En
Date: 05-10-2012
--------------------------------
Email: userb@hotmail.com
Status: waiting
Lang: En
Date: 05-10-2012
Ok now i will read this text file and write Only the Email and Status in a Richtextbox.
Like this
usera@hotmail.com;done
userb@hotmail.com;waiting
Only the status and the email should be in the Richtextbox sepperated with the “;”
The other text ( Lang , Date) can be Ignored.
My idea was Read the text file in a stream and try with a Foreach fuc to find “Email” and “Status” then print in the Richbox, but i think this is not a good way to do this.
So i ask you what is the best way to make this possible?
my test code
string[] filea = File.ReadAllLines("test.txt");
foreach (var s in filea)
{
if (s.Contains("Email"))
{
richTextBox1.AppendText(s + Environment.NewLine);
}
}
but how i get in there the “Status” too?
Thanks in Advance 🙂
To get the requested output, you’ll need to split each line and then grab just the part you want: