Advertisement
didatzi

P05_WriteToFile

Jun 28th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.56 KB | None | 0 0
  1. using System.Collections.Generic;
  2. using System.IO;
  3. using System.Linq;
  4.  
  5. namespace P05_WriteToFile
  6. {
  7.     class WriteToFile
  8.     {
  9.         static void Main()
  10.         {
  11.             string textFromFile = File.ReadAllText("sample_text.txt");
  12.             var fullText = new List<string>();
  13.             var text = textFromFile.Split(".,!?:".ToCharArray()).ToList();
  14.             foreach (var word in text)
  15.             {
  16.                 fullText.Add(word);
  17.             }
  18.             File.WriteAllText("output.txt", string.Join("", fullText));
  19.         }
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement