Char.IsLetter 方法

定义

指示 Unicode 字符是否属于 Unicode 字母类别。Indicates whether a Unicode character is categorized as a Unicode letter.

重载

IsLetter(Char)

指示指定的 Unicode 字符是否属于 Unicode 字母类别。Indicates whether the specified Unicode character is categorized as a Unicode letter.

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 WITH 抑音符)到 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 (拉丁文小写字母 Z)或 U + 03AC (带 TONOS 的希腊文小写字母 ALPHA)到 U + 03CE (带 TONOS 的希腊文小写字母 OMEGA)。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 (带有小写字母 Z 和抑扬符的拉丁文大写字母 D)或 U + 1FFC (带 PROSGEGRAMMENI 的希腊文大写字母 OMEGA)。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 (修饰符字母小型 H)到 U + 02C1 (修饰符号反向喉塞音符停止)或 U + 1D2C (修饰符字母大写 A)到 U + 1D61 (修饰符字母小写 CHI)。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 表意字符,第一个 >)到 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)

指示指定的 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

要计算的 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 WITH 抑音符)到 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 (拉丁文小写字母 Z)或 U + 03AC (带 TONOS 的希腊文小写字母 ALPHA)到 U + 03CE (带 TONOS 的希腊文小写字母 OMEGA)。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 (带有小写字母 Z 和抑扬符的拉丁文大写字母 D)或 U + 1FFC (带 PROSGEGRAMMENI 的希腊文大写字母 OMEGA)。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 (修饰符字母小型 H)到 U + 02C1 (修饰符号反向喉塞音符停止)或 U + 1D2C (修饰符字母大写 A)到 U + 1D61 (修饰符字母小写 CHI)。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 表意字符,第一个 >)到 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)

指示指定字符串中位于指定位置处的指定字符串是否属于 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

一个字符串。A string.

index
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.

异常

snulls is null.

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 WITH 抑音符)到 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 (拉丁文小写字母 Z)或 U + 03AC (带 TONOS 的希腊文小写字母 ALPHA)到 U + 03CE (带 TONOS 的希腊文小写字母 OMEGA)。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 (带有小写字母 Z 和抑扬符的拉丁文大写字母 D)或 U + 1FFC (带 PROSGEGRAMMENI 的希腊文大写字母 OMEGA)。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 (修饰符字母小型 H)到 U + 02C1 (修饰符号反向喉塞音符停止)或 U + 1D2C (修饰符字母大写 A)到 U + 1D61 (修饰符字母小写 CHI)。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 表意字符,第一个 >)到 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.

另请参阅

适用于