var sb = new StringBuilder();
foreach(var character in ". ...Мама,,,мыла\"\"\"раму???мама№№била***гейтса")
{
if(character == '.' || char.IsLetter(character))
sb.Append(character);
}
var result = sb.ToString();
var pointsCount = 0;
var str = "a.b.c....";
for(var i = 0; i < str.Length; i++) {
if(str[i] == '.')
pointsCount++;
}
var result = new string('.', pointsCount);
var pointsCount = ".a.b.c....".Count(x=>x == '.');
var result = new string('.', pointsCount);
using System;
using System.Linq;
Console.WriteLine("sum a1 a2 .. an");
while (true)
{
var input = Console.ReadLine();
if (input == null)
{
Console.WriteLine("Unknown error");
}
else
{
var tokens = input.Split(' ');
switch (tokens[0])
{
case "sum":
{
if (tokens.Length < 1)
{
Console.WriteLine("Недостаточно параметров");
break;
}
if (tokens[1] == "/?")
{
Console.WriteLine("Введите параметры в виде: sum a1 a2 .. an ");
continue;
}
var sum = tokens.Skip(1).Select(double.Parse).Sum();
Console.WriteLine($"Сумма={sum}");
}
break;
}
}
}
Покажите код.