stefan1919

TextFilter

Sep 27th, 2015
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.78 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication7
  8. {
  9.     class Program
  10.     {
  11.  
  12.         static void Main(string[] args)
  13.         {
  14.             string pattern = Console.ReadLine();
  15.             string input = Console.ReadLine();
  16.             Console.WriteLine(RemoveTargeted(input, pattern));
  17.         }
  18.        static string RemoveTargeted(string input, string targeted)
  19.         {
  20.            string[] arrayTargeted = targeted.Split(new string[]{", "}, StringSplitOptions.None);
  21.            foreach (var word in arrayTargeted)
  22.            {
  23.                input = input.Replace(word, new string('*', word.Length));
  24.            }
  25.            return input;
  26.         }
  27.        
  28.    
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment