Char.IsControl : Char « System « C# / C Sharp by API





Char.IsControl

  
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";
      }
    }
}

   
    
  










Related examples in the same category

1.Char.IsDigit
2.Char.IsLetter
3.Char.IsLower
4.Char.IsPunctuation
5.Char.IsSeparator
6.Char.IsSymbol
7.Char.IsUpper
8.Char.IsWhiteSpace
9.Char.MaxValue
10.Char.MinValue
11.Char.Parse(String value)
12.Char.ToUpper