IsControl Method

Char.IsControl Method

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

Overload List

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

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Shared Function IsControl(Char) As Boolean
[C#] public static bool IsControl(char);
[C++] public: static bool IsControl(__wchar_t);
[JScript] public static function IsControl(Char) : Boolean;

Indicates whether the character at the specified position in a specified string is categorized as a control character.

[Visual Basic] Overloads Public Shared Function IsControl(String, Integer) As Boolean
[C#] public static bool IsControl(string, int);
[C++] public: static bool IsControl(String*, int);
[JScript] public static function IsControl(String, int) : Boolean;

Example

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

[Visual Basic, C#, C++] Note   This example shows how to use one of the overloaded versions of IsControl. For other examples that might be available, see the individual overload topics.
[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

[C#] 
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"
    }
}

[C++] 
#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.

See Also

Char Structure | Char Members | System Namespace

Show:
© 2016 Microsoft