Advertisement
Guest User

15

a guest
Dec 8th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.86 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Text.RegularExpressions;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8.  
  9. namespace TFYA_lab15
  10. {
  11.     class Program
  12.     {
  13.         static void Main(string[] args)
  14.         {
  15.             Regex regex = new Regex("часы",RegexOptions.IgnoreCase);
  16.             string target = "таймер";
  17.             string text = "";
  18.             using (StreamReader sr = new StreamReader("D:\\Нужное\\ТФЯ\\lab15\\var5.txt",Encoding.UTF8))
  19.             {
  20.                 text = sr.ReadToEnd();
  21.                 text = regex.Replace(text, target);
  22.             }
  23.             using (StreamWriter sw = new StreamWriter("D:\\Нужное\\ТФЯ\\lab15\\var5.txt", false, Encoding.UTF8))
  24.             {
  25.                 sw.WriteLine(text);
  26.             }
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement