Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Char.IsDigit Method

Indicates whether a Unicode character is categorized as a decimal digit.

Overload List

Indicates whether the specified Unicode character is categorized as a decimal digit.

Supported by the .NET Compact Framework.

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

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

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


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

[Visual Basic, C#, C++] Note   This example shows how to use one of the overloaded versions of IsDigit. For other examples that might be available, see the individual overload topics.
[Visual Basic] 
Imports System

Module IsDigitSample

    Sub Main()

        Dim ch8 As Char
        ch8 = "8"c

        Console.WriteLine(Char.IsDigit(ch8))                    ' Output: "True"
        Console.WriteLine(Char.IsDigit("sample string", 6))     ' Output: "False"

    End Sub

End Module

using System;

public class IsDigitSample {
    public static void Main() {
        char ch = '8';

        Console.WriteLine(Char.IsDigit(ch));                    // Output: "True"
        Console.WriteLine(Char.IsDigit("sample string", 7));    // Output: "False"

#using <mscorlib.dll>
using namespace System;

int main() {
   char ch = '8';

   Console::WriteLine(Char::IsDigit(ch));                    // Output: "True"
   Console::WriteLine(Char::IsDigit("sample string", 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

© 2017 Microsoft