Char.IsLetter Char.IsLetter Char.IsLetter Char.IsLetter Method

定義

表示 Unicode 字元是否分類為 Unicode 字母。Indicates whether a Unicode character is categorized as a Unicode letter.

多載

IsLetter(Char) IsLetter(Char) IsLetter(Char) IsLetter(Char)

表示指定的 Unicode 字元是否分類為 Unicode 字母。Indicates whether the specified Unicode character is categorized as a Unicode letter.

IsLetter(String, Int32) IsLetter(String, Int32) IsLetter(String, Int32) IsLetter(String, Int32)

指示指定的字串中指定位置處的字元是否分類為 Unicode 字母。Indicates whether the character at the specified position in a specified string is categorized as a Unicode letter.

備註

這個方法Char會判斷是否為任何 Unicode 字母分類的成員。This method determines whether a Char is a member of any category of Unicode letter. Unicode 字母包括下列各項:Unicode letters include the following:

  • 大寫字母,例如 U + 0041 (拉丁大寫字母 A)到 U + 005A (拉丁大寫字母 Z),或 U + 0400 (西瑞爾文大寫字母 IE 含抑音符號)到 U + 042F (斯拉夫文大寫字母 YA)。Uppercase letters, such as U+0041 (LATIN CAPITAL LETTER A) through U+005A (LATIN CAPITAL LETTER Z), or U+0400 (CYRILLIC CAPITAL LETTER IE WITH GRAVE) through U+042F (CYRILLIC CAPITAL LETTER YA). 這些字元是UnicodeCategory.UppercaseLetter類別目錄的成員。These characters are members of the UnicodeCategory.UppercaseLetter category.

  • 小寫字母,例如 U + 0061 (拉丁小型字母 A)到 U + 007A (拉丁文 small 字母 Z),或 U + 03AC (希臘文小寫字母 ALPHA 含 TONOS)到 U + 03CE (希臘文小寫字母 OMEGA 加上 TONOS)。Lowercase letters, such as U+0061 (LATIN SMALL LETTER A) through U+007A (LATIN SMALL LETTER Z), or U+03AC (GREEK SMALL LETTER ALPHA WITH TONOS) through U+03CE (GREEK SMALL LETTER OMEGA WITH TONOS). 這些字元是UnicodeCategory.LowercaseLetter類別目錄的成員。These characters are members of the UnicodeCategory.LowercaseLetter category.

  • 標題大小寫字母,例如 U + 01C5 (拉丁文大寫字母 D 與小寫字母 Z 加上抑揚符)或 U + 1FFC (希臘文大寫字母 OMEGA 與 PROSGEGRAMMENI)。Title case letters, such as U+01C5 (LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON) or U+1FFC (GREEK CAPITAL LETTER OMEGA WITH PROSGEGRAMMENI). 這些字元是UnicodeCategory.TitlecaseLetter類別目錄的成員。These characters are members of the UnicodeCategory.TitlecaseLetter category.

  • 修飾詞,例如 U + 02B0 (修飾詞字母 SMALL H)到 U + 02C1 (修飾詞的反向喉塞音符號),或 U + 1D2C (修飾詞字母大寫 A)到 U + 1D61 (修飾詞字母小型的標號)。Modifiers, such as U+02B0 (MODIFIER LETTER SMALL H) through U+02C1 (MODIFIER LETTER REVERSED GLOTTAL STOP), or U+1D2C (MODIFIER LETTER CAPITAL A) through U+1D61 (MODIFIER LETTER SMALL CHI). 這些字元是UnicodeCategory.ModifierLetter類別目錄的成員。These characters are members of the UnicodeCategory.ModifierLetter category.

  • 其他字母,例如 u + 05D0 (希伯來文字母 ALEF)到 u + 05EA (希伯來文字母 TAV)、u + 0621 (阿拉伯文字母喉塞音符)到 u + 063A (阿拉伯文字母 GHAIN),或 u + 4E00 (<cjk 表意字元,First >)到 u + 9FC3 (<cjk 表意字元,Last>)。Other letters, such as U+05D0 (HEBREW LETTER ALEF) through U+05EA (HEBREW LETTER TAV), U+0621 (ARABIC LETTER HAMZA) through U+063A (ARABIC LETTER GHAIN), or U+4E00 (<CJK Ideograph, First>) through U+9FC3 (<CJK Ideograph, Last>). 這些字元是UnicodeCategory.OtherLetter類別目錄的成員。These characters are members of the UnicodeCategory.OtherLetter category.

IsLetter(Char) IsLetter(Char) IsLetter(Char) IsLetter(Char)

表示指定的 Unicode 字元是否分類為 Unicode 字母。Indicates whether the specified Unicode character is categorized as a Unicode letter.

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

參數

c
Char Char Char Char

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

傳回

true 是字母時為 c,否則為 falsetrue if c is a letter; otherwise, false.

範例

下列程式碼範例將IsLetter示範。The following code example demonstrates IsLetter.

using namespace System;
int main()
{
   char ch = '8';
   Console::WriteLine( Char::IsLetter( ch ) ); // False
   Console::WriteLine( Char::IsLetter(  "sample string", 7 ) ); // True
}

using System;

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

		Console.WriteLine(Char.IsLetter(ch));					// False
		Console.WriteLine(Char.IsLetter("sample string", 7));	// True
	}
}
Module IsLetterSample

    Sub Main()

        Dim ch8 As Char
        ch8 = "8"c

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

    End Sub

End Module

備註

這個方法Char會判斷是否為任何 Unicode 字母分類的成員。This method determines whether a Char is a member of any category of Unicode letter. Unicode 字母包括下列各項:Unicode letters include the following:

  • 大寫字母,例如 U + 0041 (拉丁大寫字母 A)到 U + 005A (拉丁大寫字母 Z),或 U + 0400 (西瑞爾文大寫字母 IE 含抑音符號)到 U + 042F (斯拉夫文大寫字母 YA)。Uppercase letters, such as U+0041 (LATIN CAPITAL LETTER A) through U+005A (LATIN CAPITAL LETTER Z), or U+0400 (CYRILLIC CAPITAL LETTER IE WITH GRAVE) through U+042F (CYRILLIC CAPITAL LETTER YA). 這些字元是UnicodeCategory.UppercaseLetter類別目錄的成員。These characters are members of the UnicodeCategory.UppercaseLetter category.

  • 小寫字母,例如 U + 0061 (拉丁小型字母 A)到 U + 007A (拉丁文 small 字母 Z),或 U + 03AC (希臘文小寫字母 ALPHA 含 TONOS)到 U + 03CE (希臘文小寫字母 OMEGA 加上 TONOS)。Lowercase letters, such as U+0061 (LATIN SMALL LETTER A) through U+007A (LATIN SMALL LETTER Z), or U+03AC (GREEK SMALL LETTER ALPHA WITH TONOS) through U+03CE (GREEK SMALL LETTER OMEGA WITH TONOS). 這些字元是UnicodeCategory.LowercaseLetter類別目錄的成員。These characters are members of the UnicodeCategory.LowercaseLetter category.

  • 標題大小寫字母,例如 U + 01C5 (拉丁文大寫字母 D 與小寫字母 Z 加上抑揚符)或 U + 1FFC (希臘文大寫字母 OMEGA 與 PROSGEGRAMMENI)。Title case letters, such as U+01C5 (LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON) or U+1FFC (GREEK CAPITAL LETTER OMEGA WITH PROSGEGRAMMENI). 這些字元是UnicodeCategory.TitlecaseLetter類別目錄的成員。These characters are members of the UnicodeCategory.TitlecaseLetter category.

  • 修飾詞,例如 U + 02B0 (修飾詞字母 SMALL H)到 U + 02C1 (修飾詞的反向喉塞音符號),或 U + 1D2C (修飾詞字母大寫 A)到 U + 1D61 (修飾詞字母小型的標號)。Modifiers, such as U+02B0 (MODIFIER LETTER SMALL H) through U+02C1 (MODIFIER LETTER REVERSED GLOTTAL STOP), or U+1D2C (MODIFIER LETTER CAPITAL A) through U+1D61 (MODIFIER LETTER SMALL CHI). 這些字元是UnicodeCategory.ModifierLetter類別目錄的成員。These characters are members of the UnicodeCategory.ModifierLetter category.

  • 其他字母,例如 u + 05D0 (希伯來文字母 ALEF)到 u + 05EA (希伯來文字母 TAV)、u + 0621 (阿拉伯文字母喉塞音符)到 u + 063A (阿拉伯文字母 GHAIN),或 u + 4E00 (<cjk 表意字元,First >)到 u + 9FC3 (<cjk 表意字元,Last>)。Other letters, such as U+05D0 (HEBREW LETTER ALEF) through U+05EA (HEBREW LETTER TAV), U+0621 (ARABIC LETTER HAMZA) through U+063A (ARABIC LETTER GHAIN), or U+4E00 (<CJK Ideograph, First>) through U+9FC3 (<CJK Ideograph, Last>). 這些字元是UnicodeCategory.OtherLetter類別目錄的成員。These characters are members of the UnicodeCategory.OtherLetter category.

另請參閱

IsLetter(String, Int32) IsLetter(String, Int32) IsLetter(String, Int32) IsLetter(String, Int32)

指示指定的字串中指定位置處的字元是否分類為 Unicode 字母。Indicates whether the character at the specified position in a specified string is categorized as a Unicode letter.

public:
 static bool IsLetter(System::String ^ s, int index);
public static bool IsLetter (string s, int index);
static member IsLetter : string * int -> bool
Public Shared Function IsLetter (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; otherwise, false.

例外狀況

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

範例

下列程式碼範例將IsLetter示範。The following code example demonstrates IsLetter.

using namespace System;
int main()
{
   char ch = '8';
   Console::WriteLine( Char::IsLetter( ch ) ); // False
   Console::WriteLine( Char::IsLetter(  "sample string", 7 ) ); // True
}

using System;

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

		Console.WriteLine(Char.IsLetter(ch));					// False
		Console.WriteLine(Char.IsLetter("sample string", 7));	// True
	}
}
Module IsLetterSample

    Sub Main()

        Dim ch8 As Char
        ch8 = "8"c

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

    End Sub

End Module

備註

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

這個方法會判斷字串中指定索引位置處的字元是否為任何 Unicode 字母分類的成員。This method determines whether the character at a specified index position in a string is a member of any category of Unicode letter. Unicode 字母包括下列各項:Unicode letters include the following:

  • 大寫字母,例如 U + 0041 (拉丁大寫字母 A)到 U + 005A (拉丁大寫字母 Z),或 U + 0400 (西瑞爾文大寫字母 IE 含抑音符號)到 U + 042F (斯拉夫文大寫字母 YA)。Uppercase letters, such as U+0041 (LATIN CAPITAL LETTER A) through U+005A (LATIN CAPITAL LETTER Z), or U+0400 (CYRILLIC CAPITAL LETTER IE WITH GRAVE) through U+042F (CYRILLIC CAPITAL LETTER YA). 這些字元是UnicodeCategory.UppercaseLetter類別目錄的成員。These characters are members of the UnicodeCategory.UppercaseLetter category.

  • 小寫字母,例如 U + 0061 (拉丁小型字母 A)到 U + 007A (拉丁文 small 字母 Z),或 U + 03AC (希臘文小寫字母 ALPHA 含 TONOS)到 U + 03CE (希臘文小寫字母 OMEGA 加上 TONOS)。Lowercase letters, such as U+0061 (LATIN SMALL LETTER A) through U+007A (LATIN SMALL LETTER Z), or U+03AC (GREEK SMALL LETTER ALPHA WITH TONOS) through U+03CE (GREEK SMALL LETTER OMEGA WITH TONOS). 這些字元是UnicodeCategory.LowercaseLetter類別目錄的成員。These characters are members of the UnicodeCategory.LowercaseLetter category.

  • 標題大小寫字母,例如 U + 01C5 (拉丁文大寫字母 D 與小寫字母 Z 加上抑揚符)或 U + 1FFC (希臘文大寫字母 OMEGA 與 PROSGEGRAMMENI)。Title case letters, such as U+01C5 (LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON) or U+1FFC (GREEK CAPITAL LETTER OMEGA WITH PROSGEGRAMMENI). 這些字元是UnicodeCategory.TitlecaseLetter類別目錄的成員。These characters are members of the UnicodeCategory.TitlecaseLetter category.

  • 修飾詞,例如 U + 02B0 (修飾詞字母 SMALL H)到 U + 02C1 (修飾詞的反向喉塞音符號),或 U + 1D2C (修飾詞字母大寫 A)到 U + 1D61 (修飾詞字母小型的標號)。Modifiers, such as U+02B0 (MODIFIER LETTER SMALL H) through U+02C1 (MODIFIER LETTER REVERSED GLOTTAL STOP), or U+1D2C (MODIFIER LETTER CAPITAL A) through U+1D61 (MODIFIER LETTER SMALL CHI). 這些字元是UnicodeCategory.ModifierLetter類別目錄的成員。These characters are members of the UnicodeCategory.ModifierLetter category.

  • 其他字母,例如 u + 05D0 (希伯來文字母 ALEF)到 u + 05EA (希伯來文字母 TAV)、u + 0621 (阿拉伯文字母喉塞音符)到 u + 063A (阿拉伯文字母 GHAIN),或 u + 4E00 (<cjk 表意字元,First >)到 u + 9FC3 (<cjk 表意字元,Last>)。Other letters, such as U+05D0 (HEBREW LETTER ALEF) through U+05EA (HEBREW LETTER TAV), U+0621 (ARABIC LETTER HAMZA) through U+063A (ARABIC LETTER GHAIN), or U+4E00 (<CJK Ideograph, First>) through U+9FC3 (<CJK Ideograph, Last>). 這些字元是UnicodeCategory.OtherLetter類別目錄的成員。These characters are members of the UnicodeCategory.OtherLetter category.

另請參閱

適用於