Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Collections.Specialized;
- using System.Text;
- using System.Threading.Tasks;
- using System.Net;
- using System.Threading;
- using System.IO;
- namespace IMJunior
- {
- class Program
- {
- static void Main()
- {
- string[] list = { "Хуй", "Жопа", "Кевин Спейси" };
- string text = "В голивуде прошёл слух, что Кевин Спейси что-то сделал";
- text = Filter(text, list);
- string line = GenerateString(Console.WindowWidth, "-");
- WriteColorLine(line);
- WriteColorLine(text, ConsoleColor.Yellow);
- WriteColorLine(line);
- }
- static string Filter(string text, string[] blackList)
- {
- for(int i = 0; i < blackList.Length; i++)
- {
- text = text.Replace(blackList[i],
- GenerateString(blackList[i].Length));
- }
- return text;
- }
- static string GenerateString(int length, string fuller = "#")
- {
- if (fuller.Length == 0)
- {
- return "";
- }
- string mask = "";
- for (int j = 0; j < length; j += fuller.Length)
- {
- mask += fuller;
- }
- mask = mask.Substring(0, length);
- return mask;
- }
- static void WriteColorLine(string message, ConsoleColor color = ConsoleColor.Red)
- {
- ConsoleColor old = Console.ForegroundColor;
- Console.ForegroundColor = color;
- Console.WriteLine(message);
- Console.ForegroundColor = old;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment