Skip to content

Instantly share code, notes, and snippets.

@Zulcom
Created May 4, 2020 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Zulcom/55997aa14a98d28438fc6862a5ef701e to your computer and use it in GitHub Desktop.
Save Zulcom/55997aa14a98d28438fc6862a5ef701e to your computer and use it in GitHub Desktop.
C# – Удалить из введёной строки все согласные буквы.
using System;
using System.Text.RegularExpressions;
namespace strings
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Type in string to process:"); // пишем запрос в консоль
var userInput = Console.ReadLine(); // читаем ввод от пользователя в переменную userInput
Console.WriteLine(Regex.Replace(userInput, "(?i)[бвгджзйклмнпрстфхцчшщ]", ""));
// Что такое Regex: https://ru.wikipedia.org/wiki/Регулярные_выражения
// Regex.Replace(гдеИщем, чтоИщем, наЧтоМеняем) = найти и заменить
// (?i) = искать игнорируя регистр букв
// [бвгджзйклмнпрстфхцчшщ] = любой сивол заключенный в квадратные скобки
// Console.WriteLine = вывести в консоль
}
}
}
@SkaziATM
Copy link

Как дела

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment