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. |
範例
下列程式碼範例將示範 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 (拉丁小寫字母 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 (修飾詞字母小型 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 (阿拉伯文字母 HAMZA) 至 U + 063A (阿拉伯文字母 GHAIN) ,或 U + >894f8612-e0ed-4e00-84cf-a9bc8f38fc54 () <CJK Ideograph, First> 至 u + 9FC3 (<CJK Ideograph, 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
,否則為 false
。true
if c
is a letter; otherwise, false
.
備註
這個方法會判斷是否 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 (拉丁小寫字母 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 (修飾詞字母小型 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 (阿拉伯文字母 HAMZA) 至 U + 063A (阿拉伯文字母 GHAIN) ,或 U + >894f8612-e0ed-4e00-84cf-a9bc8f38fc54 () <CJK Ideograph, First> 至 u + 9FC3 (<CJK Ideograph, 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
,否則為 false
。true
if the character at position index
in s
is a letter; otherwise, false
.
例外狀況
s
為 null
。s
is null
.
index
小於零或大於 s
中的最後一個位置。index
is less than zero or greater than the last position in s
.
備註
字串中的字元位置會從零開始編制索引。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 (拉丁小寫字母 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 (修飾詞字母小型 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 (阿拉伯文字母 HAMZA) 至 U + 063A (阿拉伯文字母 GHAIN) ,或 U + >894f8612-e0ed-4e00-84cf-a9bc8f38fc54 () <CJK Ideograph, First> 至 u + 9FC3 (<CJK Ideograph, 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.