Advertisement
Guest User

Untitled

a guest
Apr 30th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. var lines = new List<string>();
  2. // read lines from file to lines list
  3.  
  4. var stringBuilder = new StringBuilder();
  5.  
  6. foreach(var line in lines)
  7. {
  8. var semicolonCount = line.Count(x => x == ';');
  9. if(0 < semicolonCount < 3)
  10. {
  11. line = line.Replace(System.Environment.NewLine, string.Empty);
  12. }
  13.  
  14. stringBuilder.Append(line);
  15. }
  16.  
  17. var resultText = stringBuilder.ToString();
  18. // write this into the file
  19.  
  20. string[] lines = theText.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
  21. string[] resultLines = lines.Where(l => l.Contains(";;;")).ToArray();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement