Advertisement
kirya_shkolnik

c# - убрать знаки препинания

Jan 21st, 2021
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1. using System;
  2. using System.Text;
  3. using System.Collections.Generic;
  4. class Practic {
  5.   public static string var15(string str) {
  6.     char[] punctuation = { ',', '.', ' ', ';', ':', '?', '!' };
  7.     string[] words = str.Split(punctuation, StringSplitOptions.RemoveEmptyEntries);
  8.     str = String.Join(" ", words);
  9.     return str;
  10.   }
  11.   public static void Main() {
  12.     List < string > str = new List < string > ();
  13.     Console.WriteLine("Введите строки");
  14.     string input = "";
  15.     while ((input = Console.ReadLine()) != "")
  16.       str.Add(input);
  17.     foreach(var s in str) {
  18.       Console.WriteLine(var15(s));
  19.  
  20.     }
  21.   }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement