Uređivanje

Dijeli putem


Char.IsLetterOrDigit Method

Definition

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

Overloads

IsLetterOrDigit(String, Int32)

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

IsLetterOrDigit(Char)

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

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
    }
}
open System

let str = "newline:\n"

printfn $"{Char.IsLetterOrDigit '8'}"       // Output: "True"
printfn $"{Char.IsLetterOrDigit(str, 8)}"   // Output: "False", because it's a newline
Module IsLetterOrDigitSample

    Sub Main()

        Dim str As String
        str = "newline:" + Environment.NewLine

        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.

IsLetterOrDigit(String, Int32)

Source:
Char.cs
Source:
Char.cs
Source:
Char.cs

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

A string.

index
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

index is less than zero or greater than the last position in s.

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

IsLetterOrDigit(Char)

Source:
Char.cs
Source:
Char.cs
Source:
Char.cs

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

The Unicode character to evaluate.

Returns

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

Remarks

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

See also

Applies to