This documentation is archived and is not being maintained.

Char.IsControl Method (Char)

.NET Framework 1.1

Indicates whether the specified Unicode character is categorized as a control character.

[Visual Basic]
Overloads Public Shared Function IsControl( _
   ByVal c As Char _
) As Boolean
public static bool IsControl(
 char c
public: static bool IsControl(
 __wchar_t c
public static function IsControl(
   c : Char
) : Boolean;


A Unicode character.

Return Value

true if c is a control character; otherwise, false.


Valid control characters are members of the following category in UnicodeCategory: Control.


[Visual Basic, C#, C++] The following sample demonstrates IsControl.

[Visual Basic] 
imports System

Module IsControlSample

    Sub Main()

        Dim chTab As Char
        chTab = Chr(9)      ' Tab character
        Dim str As String
        str = "sample string"

        Console.WriteLine(Char.IsControl(chTab))    ' Output: "True"
        Console.WriteLine(Char.IsControl(str, 6))   ' Output: "False"

    End Sub

End Module

using System;

public class IsControlSample {
    public static void Main() {
        string str = "sample string";

        Console.WriteLine(Char.IsControl('\t'));    // Output: "True"
        Console.WriteLine(Char.IsControl(str, 7));    // Output: "False"

#using <mscorlib.dll>
using namespace System;

int main() {
    String* str = "sample string";

    Console::WriteLine(Char::IsControl('\t'));    // Output: "True"
    Console::WriteLine(Char::IsControl(str, 7));    // Output: "False"

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

Char Structure | Char Members | System Namespace | Char.IsControl Overload List