using System;
namespace csharp.Example.System
{
public class DeterminingCharType
{
public static void Main(string[] args)
{
Console.WriteLine("please enter character");
char c = Convert.ToChar(Console.ReadLine());
if (Char.IsDigit(c))
{
Console.WriteLine("Char " + c + " is digit");
}
else if (Char.IsNumber(c))
{
Console.WriteLine("Char " + c + " is number");
}
else if (Char.IsSeparator(c))
{
Console.WriteLine("Char " + c + " is separator");
}
else if (Char.IsSymbol(c))
{
Console.WriteLine("Char " + c + " is symbol");
}
else if (Char.IsControl(c))
{
Console.WriteLine("Char " + c + " is control");
}
else if (Char.IsLetter(c))
{
Console.WriteLine("Char " + c + " is letter");
}
else if (Char.IsPunctuation(c))
{
Console.WriteLine("Char " + c + " is punctuation");
}
else if (Char.IsSurrogate(c))
{
Console.WriteLine("Char " + c + " is surrogate");
}
else if (Char.IsWhiteSpace(c))
{
Console.WriteLine("Char " + c + " is whitespace");
}
Console.ReadLine();
}
}
}
Be Different with excellent knowledge A Devloper Blog....
Subscribe to:
Post Comments (Atom)
-
Make Your Own Notepad In this tutorial we will be making a simple C# Notepad with the option to Clear, Cut, Copy, Paste, Select All, Save...
-
How to get Ram Details in C# using System; using System.Runtime.InteropServices; [StructLayout(LayoutKind.Sequential)] class Blittabl...
No comments:
Post a Comment
Your comment is pending for approval