Char.IsLetter Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Indicates whether a Unicode character is categorized as a Unicode letter.
IsLetter(Char) |
Indicates whether the specified Unicode character is categorized as a Unicode letter. |
IsLetter(String, Int32) |
Indicates whether the character at the specified position in a specified string is categorized as a Unicode letter. |
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
}
}
open System
let ch = '8'
printfn $"{Char.IsLetter ch}" // False
printfn $"""{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
This method determines whether a Char is a member of any category of Unicode letter. Unicode letters include the following:
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). These characters are members of the UnicodeCategory.UppercaseLetter category.
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). These characters are members of the UnicodeCategory.LowercaseLetter category.
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). These characters are members of the UnicodeCategory.TitlecaseLetter category.
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). These characters are members of the UnicodeCategory.ModifierLetter category.
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>). These characters are members of the UnicodeCategory.OtherLetter category.
- Source:
- Char.cs
- Source:
- Char.cs
- Source:
- Char.cs
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
Parameters
- c
- Char
The Unicode character to evaluate.
Returns
true
if c
is a letter; otherwise, false
.
Remarks
This method determines whether a Char is a member of any category of Unicode letter. Unicode letters include the following:
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). These characters are members of the UnicodeCategory.UppercaseLetter category.
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). These characters are members of the UnicodeCategory.LowercaseLetter category.
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). These characters are members of the UnicodeCategory.TitlecaseLetter category.
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). These characters are members of the UnicodeCategory.ModifierLetter category.
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>). These characters are members of the UnicodeCategory.OtherLetter category.
See also
Applies to
.NET 9 a další verze
Produkt | Verze |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 2.0, 2.1 |
UWP | 10.0 |
- 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 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
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; otherwise, false
.
Exceptions
s
is null
.
index
is less than zero or greater than the last position in s
.
Remarks
Character positions in a string are indexed starting from zero.
This method determines whether the character at a specified index position in a string is a member of any category of Unicode letter. Unicode letters include the following:
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). These characters are members of the UnicodeCategory.UppercaseLetter category.
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). These characters are members of the UnicodeCategory.LowercaseLetter category.
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). These characters are members of the UnicodeCategory.TitlecaseLetter category.
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). These characters are members of the UnicodeCategory.ModifierLetter category.
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>). These characters are members of the UnicodeCategory.OtherLetter category.
See also
Applies to
.NET 9 a další verze
Produkt | Verze |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 2.0, 2.1 |
UWP | 10.0 |
Zpětná vazba k produktu .NET
.NET je open source projekt. Vyberte odkaz pro poskytnutí zpětné vazby: