Добавьте файлы проекта.

This commit is contained in:
RomaZhopka 2024-03-29 18:14:12 +03:00
parent 0396adddb6
commit dcfd7c6e70
21 changed files with 1928 additions and 0 deletions

23
Services/InputService.cs Normal file
View file

@ -0,0 +1,23 @@
namespace calculator.Services
{
internal class InputService : IInputService
{
public string TryInput(string input)
{
//если есть знак "бесконечность" - не даёт писать цифры после него
if (input.Contains('∞'))
{
input = input[..^1];
}
//ситуация: слева ноль, а после него НЕ запятая, тогда ноль можно удалить
if (input[0] == '0' && (input.IndexOf(".", StringComparison.Ordinal) != 1))
{
input = input.Remove(0, 1);
}
return input;
}
}
}