-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKod29_Regex.cs
More file actions
29 lines (25 loc) · 902 Bytes
/
Kod29_Regex.cs
File metadata and controls
29 lines (25 loc) · 902 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System.Diagnostics;
using System.Reflection.Metadata.Ecma335;
using System.Reflection.PortableExecutable;
using System.Linq;
using System.Collections.Generic;
using System.Diagnostics.Metrics;
using System.Collections;
using System.Text;
using System.Text.RegularExpressions;
using static System.Net.Mime.MediaTypeNames;
/*Задача 29:Regex (простой)
Введи строку.
Проверь, состоит ли она только из цифр (используй Regex.IsMatch).
Если да — выведи "Только цифры", иначе "Есть другие символы".*/
class Program
{
static void Main()
{
string onlyMath = Console.ReadLine();
if (Regex.IsMatch(onlyMath, @"^\d+$"))
{
Console.WriteLine("Только цифры");
} else Console.WriteLine("Есть другие символы");
}
}