Chandrakant Patil
How to find how many Uppercase, Lowercase and Numbers in the string
By Chandrakant Patil in C# Strings on Mar 18 2019
  • Pranam Bhat
    May, 2021 22

    using System;class Count {public static void Main(){String str = "ABCdefg123@#";int upper = 0, lower = 0;int number = 0, special = 0;for(int i = 0; i < str.Length; i ){char ch = str[i];if (ch >= 'A' && ch <= 'Z')upper ;else if (ch >= 'a' && ch <= 'z')lower ;else if (ch >= '0' && ch <= '9')number ;elsespecial ;}Console.WriteLine("Upper case letters : " upper);Console.WriteLine("Lower case letters : " lower);Console.WriteLine("Number : " number);Console.Write("Special characters : " special);} }

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS