コード例 #1
0
        static void Main(string[] args)
        {
            String ch;
            char   ch1;
            int    ret = 0;

            Console.WriteLine("Enter string");
            ch = Convert.ToString(Console.ReadLine());
            Console.WriteLine("Enter A Single Charcter");
            ch1 = Convert.ToChar(Console.ReadLine());
            MarvellousString ob = new MarvellousString(ch);

            ret = ob.strlenx();
            Console.WriteLine("length of String is : " + ret);


            ret = ob.CountCapital();
            Console.WriteLine("Count of Capital character is " + ret);



            ret = ob.CountSmall();
            Console.WriteLine("Count of small character is " + ret);


            ret = ob.Frequency(ch1);
            Console.WriteLine("frequancy of character is " + ret);


            ret = ob.CountVowels();
            Console.WriteLine("Count of Vowels is " + ret);



            ret = ob.CountSpace();
            Console.WriteLine("Count of space  is " + ret);


            ret = ob.SearchFirst(ch1);
            Console.WriteLine("first Position of character is " + ret);


            ret = ob.SearchLast(ch1);
            Console.WriteLine("last Position of character is " + ret);

            if (ob.CheckPalindrome())
            {
                Console.WriteLine("String is Pallindrome");
            }
            else
            {
                Console.WriteLine("String is not Pallindrome");
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: SnehalShimpi/C-Sharp
        static void Main(string[] args)
        {
            String ch;
            char   ch1;
            int    ret = 0;

            Console.WriteLine("Enter string");
            ch = Convert.ToString(Console.ReadLine());
            Console.WriteLine("Enter A Single Charcter");
            ch1 = Convert.ToChar(Console.ReadLine());
            MarvellousString ob = new MarvellousString(ch);

            Console.WriteLine("--------------length of String is----------");
            ret = ob.strlenx();
            Console.WriteLine("{0}", ret);
            Console.WriteLine("--------------Count of Capital character is----------");
            ret = ob.CountCapital();
            Console.WriteLine("{0}", ret);
            Console.WriteLine("--------------Count of small character is----------");
            ret = ob.CountSmall();
            Console.WriteLine("{0}", ret);
            Console.WriteLine("--------------frequancy of  character is----------");
            ret = ob.Frequency(ch1);
            Console.WriteLine("{0}", ret);
            Console.WriteLine("--------------Count Vowels is----------");
            ret = ob.CountVowels();
            Console.WriteLine("{0}", ret);
            Console.WriteLine("--------------Count space  is----------");
            ret = ob.CountSpace();
            Console.WriteLine("{0}", ret);
            Console.WriteLine("--------------first Search  character is----------");
            ret = ob.SearchFirst(ch1);
            Console.WriteLine("{0}", ret);
            Console.WriteLine("--------------last Search  character is----------");
            ret = ob.SearchLast(ch1);
            Console.WriteLine("{0}", ret);
        }