using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Runtime.InteropServices.JavaScript.JSType;
namespace Library9Delegates
{
delegate int SimbolInStr(char simbol, string str);
internal class StringOperations
{
///
/// Количество вхождений символа в строку
///
///
///
///
public static int GetNumberSimbolInStr(char simbol, string str)
{
int count = 0;
for (int i = 0; i < str.Length; i++)
{
if (str[i] == simbol)
{
count++;
}
}
return count;
}
///
/// Возвращает индекс первого вхождения в строку и -1, если в строке нет символа
///
///
///
///
public static int GetIndexSimbolInStr(char simbol, string str) => str.IndexOf(simbol);
}
}