Get char type : Char : Data Types C# Source Code


Custom Search

C# Source Code » Data Types » Char »

 

Get char type









    


using System;
using System.Data;
using System.Text.RegularExpressions;
using System.Text;
class Class1{
        static void Main(string[] args){
            Console.WriteLine(GetCharKind('f'));
            Console.WriteLine(GetCharKind('0'));
            Console.WriteLine(GetCharKind('.'));
            Console.WriteLine(GetCharKind('}'));
        }
    public static String GetCharKind(char theChar)
    {
      if (Char.IsControl(theChar))
      {
        return "Control";
      }
      else if (Char.IsDigit(theChar))
      {
        return "Digit";
      }
      else if (Char.IsLetter(theChar))
      {
        return "Letter";
      }
      else if (Char.IsNumber(theChar))
      {
        return "Number";
      }
      else if (Char.IsPunctuation(theChar))
      {
        return "Punctuation";
      }
      else if (Char.IsSeparator(theChar))
      {
        return "Separator";
      }
      else if (Char.IsSurrogate(theChar))
      {
        return "Surrogate";
      }
      else if (Char.IsSymbol(theChar))
      {
        return "Symbol";
      }
      else if (Char.IsWhiteSpace(theChar))
      {
        return "Whitespace";
      }
      else
      {
        return "Unknown";
      }
    }
}

           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Data Types
» Char