Q:

Write a C# Sharp program to count a specified character (both cases) in a given string

0

Write a C# Sharp program to count a specified character (both cases) in a given string

Sample Output:

3
2

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

using System;
namespace exercises
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(test("PHP Exercises", 'E', 'e'));
            Console.WriteLine(test("Latest News, Breaking News LIVE", 'A', 'a'));
        }
        public static int test(string str1, char uc, char lc)
        {
            return str1.Split(uc, lc).Length - 1;
        }
    }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now