Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Count the number of capital letters, small letters, digits, spaces and special characters.
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { string s = "THIS ThaT 12546 !@#$%^&"; int number = 0; int capitalLetter = 0; int smallletter = 0; int space = 0; int SpecialSymbol = 0; char[] a = s.ToCharArray(); for (int i = 0; i < a.Length; i++) { if (a[i] >= 48 && a[i] <= 58) { number += 1; } else if (a[i] >= 65 && a[i] <= 90) { capitalLetter += 1; } else if (a[i] >= 97 && a[i] <= 122) { smallletter += 1; } else if (a[i] == 32) { space += 1; } else { SpecialSymbol += 1; } } Console.Write("Capital Letter " + capitalLetter); Console.Write("\nsmall letter " + smallletter); Console.Write("\nnumber are " + number); Console.Write("\nTotal Spaces " + space); Console.Write("\nTotal Special Symbol are " + SpecialSymbol); } } }
run
|
edit
|
history
|
help
0
Teabag
With Arguments
String to Byte[] Conversion
6
C# simple fib solution
Example of dates in c#, Ejemplo de fechas en c#
Pyramid
Математика
Get a webpage - the async way
jjj