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

定義

指示 Unicode 字元是否分類為字母或十進位數字。Indicates whether a Unicode character is categorized as a letter or a decimal digit.

多載

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

指示指定的 Unicode 字元是否分類為字母或十進位數字。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.

備註

有效的字母和十進位數是UnicodeCategory中下列類別的成員: UppercaseLetterLowercaseLetterTitlecaseLetter ModifierLetter OtherLetter、、或DecimalDigitNumberValid 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)

指示指定的 Unicode 字元是否分類為字母或十進位數字。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

參數

c
Char Char Char Char

要評估的 Unicode 字元。The Unicode character to evaluate.

傳回

true 是字母或十進位數字時為 c,否則為 falsetrue if c is a letter or a decimal digit; otherwise, false.

範例

下列程式碼範例將IsLetterOrDigit示範。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
    }
}
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

備註

有效的字母和十進位數是UnicodeCategory中下列類別的成員: UppercaseLetterLowercaseLetterTitlecaseLetter ModifierLetter OtherLetter、、或DecimalDigitNumberValid letters and decimal digits are members of the following categories in UnicodeCategory: UppercaseLetter, LowercaseLetter, TitlecaseLetter, ModifierLetter, OtherLetter, or DecimalDigitNumber.

另請參閱

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

參數

s
String String String String

字串。A string.

index
Int32 Int32 Int32 Int32

要評估的字元在 s 中的位置。The position of the character to evaluate in s.

傳回

true 中位於 index 的字元是字母或十進位數字時為 s,否則為 falsetrue if the character at position index in s is a letter or a decimal digit; otherwise, false.

例外狀況

index 小於零或大於 s 中的最後一個位置。index is less than zero or greater than the last position in s.

範例

下列程式碼範例將IsLetterOrDigit示範。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
    }
}
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

備註

字串中的字元位置會從零開始編制索引。Character positions in a string are indexed starting from zero.

有效的字母和十進位數是UnicodeCategory中下列類別的成員: UppercaseLetterLowercaseLetterTitlecaseLetter ModifierLetter OtherLetter、、或DecimalDigitNumberValid letters and decimal digits are members of the following categories in UnicodeCategory: UppercaseLetter, LowercaseLetter, TitlecaseLetter, ModifierLetter, OtherLetter, or DecimalDigitNumber.

另請參閱

適用於