C# Char IsControl(Char)

Description

Char IsControl(Char) indicates whether the specified Unicode character is categorized as a control character.

Syntax

Char.IsControl(Char) has the following syntax.


public static bool IsControl(
  char c
)

Parameters

Char.IsControl(Char) has the following parameters.

  • c - The Unicode character to evaluate.

Returns

Char.IsControl(Char) method returns true if c is a control character; otherwise, false.

Example

The following example lists the Unicode code point of each of the control characters.


//from w w w.  ja v a 2  s.  com
using System;

public class MainClass
{
   public static void Main()
   {
      for (int ctr = 0x00; ctr <= 0xFFFF; ctr++)
      {
         char ch = Convert.ToChar(ctr);
         if (char.IsControl(ch))
         {
            Console.WriteLine(@"\U{0:X4}    ", ctr);
         }
      }
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version