Guest User

Untitled

a guest
Jan 15th, 2019
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. Compare / Search Text Files Line by Line Search for particular words
  2. Email: usera@hotmail.com
  3. Status: done
  4. Lang: En
  5. Date: 05-10-2012
  6. --------------------------------
  7. Email: userb@hotmail.com
  8. Status: waiting
  9. Lang: En
  10. Date: 05-10-2012
  11.  
  12. usera@hotmail.com;done
  13. userb@hotmail.com;waiting
  14.  
  15. string[] filea = File.ReadAllLines("test.txt");
  16. foreach (var s in filea)
  17. {
  18. if (s.Contains("Email"))
  19. {
  20.  
  21. richTextBox1.AppendText(s + Environment.NewLine);
  22. }
  23.  
  24. }
  25.  
  26. string[] filea = File.ReadAllLines("test.txt");
  27. foreach (var s in filea)
  28. {
  29. string[] parts = s.Split(':');
  30.  
  31. if (parts.Length == 2)
  32. {
  33. if (parts[0].Contains("Email"))
  34. richTextBox1.AppendText(parts[1].Trim());
  35.  
  36. if (parts[0].Contains("Status"))
  37. richTextBox1.AppendText(":" + parts[1].Trim() + Environment.NewLine);
  38. }
  39. }
Add Comment
Please, Sign In to add comment