Char.IsLetterOrDigit Char.IsLetterOrDigit Char.IsLetterOrDigit Char.IsLetterOrDigit Method

Definition

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

Overloads

IsLetterOrDigit(Char) IsLetterOrDigit(Char) IsLetterOrDigit(Char) IsLetterOrDigit(Char)

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

IsLetterOrDigit(String, Int32) IsLetterOrDigit(String, Int32) IsLetterOrDigit(String, Int32) IsLetterOrDigit(String, Int32)

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

Remarks

Valid letters and decimal digits are members of the following categories in UnicodeCategory: UppercaseLetter, LowercaseLetter, TitlecaseLetter, ModifierLetter, OtherLetter, or DecimalDigitNumber.

IsLetterOrDigit(Char) IsLetterOrDigit(Char) IsLetterOrDigit(Char) IsLetterOrDigit(Char)

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

public:
 static bool IsLetterOrDigit(char c);
public static bool IsLetterOrDigit (char c);
static member IsLetterOrDigit : char -> bool
Public Shared Function IsLetterOrDigit (c As Char) As Boolean

Parameters

c
Char Char Char Char

The Unicode character to evaluate.

Returns

true if c is a letter or a decimal digit; otherwise, false.

Examples

The following code example demonstrates IsLetterOrDigit.

using namespace System;
int main()
{
   String^ str =  "newline:\n";
   Console::WriteLine( Char::IsLetterOrDigit( '8' ) ); // Output: "True"
   Console::WriteLine( Char::IsLetterOrDigit( str, 8 ) ); // Output: "False", because it's a newline
}

using System;

public class IsLetterOrDigitSample {
	public static void Main() {
		string str = "newline:\n";

		Console.WriteLine(Char.IsLetterOrDigit('8'));		// Output: "True"
		Console.WriteLine(Char.IsLetterOrDigit(str, 8));	// Output: "False", because it's a newline
	}
}
imports System

Module IsLetterOrDigitSample

    Sub Main()

        Dim str As String
        str = "newline:" + vbNewLine

        Console.WriteLine(Char.IsLetterOrDigit("8"c))       ' Output: "True"
        Console.WriteLine(Char.IsLetterOrDigit(str, 8))     ' Output: "False", because it's a NewLine

    End Sub

End Module

Remarks

Valid letters and decimal digits are members of the following categories in UnicodeCategory: UppercaseLetter, LowercaseLetter, TitlecaseLetter, ModifierLetter, OtherLetter, or DecimalDigitNumber.

See also

IsLetterOrDigit(String, Int32) IsLetterOrDigit(String, Int32) IsLetterOrDigit(String, Int32) IsLetterOrDigit(String, Int32)

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

public:
 static bool IsLetterOrDigit(System::String ^ s, int index);
public static bool IsLetterOrDigit (string s, int index);
static member IsLetterOrDigit : string * int -> bool
Public Shared Function IsLetterOrDigit (s As String, index As Integer) As Boolean

Parameters

s
String String String String

A string.

index
Int32 Int32 Int32 Int32

The position of the character to evaluate in s.

Returns

true if the character at position index in s is a letter or a decimal digit; otherwise, false.

Exceptions

Examples

The following code example demonstrates IsLetterOrDigit.

using namespace System;
int main()
{
   String^ str =  "newline:\n";
   Console::WriteLine( Char::IsLetterOrDigit( '8' ) ); // Output: "True"
   Console::WriteLine( Char::IsLetterOrDigit( str, 8 ) ); // Output: "False", because it's a newline
}

using System;

public class IsLetterOrDigitSample {
	public static void Main() {
		string str = "newline:\n";

		Console.WriteLine(Char.IsLetterOrDigit('8'));		// Output: "True"
		Console.WriteLine(Char.IsLetterOrDigit(str, 8));	// Output: "False", because it's a newline
	}
}
imports System

Module IsLetterOrDigitSample

    Sub Main()

        Dim str As String
        str = "newline:" + vbNewLine

        Console.WriteLine(Char.IsLetterOrDigit("8"c))       ' Output: "True"
        Console.WriteLine(Char.IsLetterOrDigit(str, 8))     ' Output: "False", because it's a NewLine

    End Sub

End Module

Remarks

Character positions in a string are indexed starting from zero.

Valid letters and decimal digits are members of the following categories in UnicodeCategory: UppercaseLetter, LowercaseLetter, TitlecaseLetter, ModifierLetter, OtherLetter, or DecimalDigitNumber.

See also

Applies to