Created
May 4, 2020 14:20
-
-
Save Zulcom/55997aa14a98d28438fc6862a5ef701e to your computer and use it in GitHub Desktop.
C# – Удалить из введёной строки все согласные буквы.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = вывести в консоль | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Как дела