Char.GetUnicodeCategory Methode
Definition
Kategorisiert ein Unicode-Zeichen in einer Gruppe, die durch einen der UnicodeCategory-Werte bezeichnet wird.Categorizes a Unicode character into a group identified by one of the UnicodeCategory values.
Überlädt
GetUnicodeCategory(Char) |
Kategorisiert ein angegebenes Unicode-Zeichen in einer Gruppe, die durch einen der UnicodeCategory-Werte bezeichnet wird.Categorizes a specified Unicode character into a group identified by one of the UnicodeCategory values. |
GetUnicodeCategory(String, Int32) |
Kategorisiert das Zeichen an der angegebenen Position in einer angegebenen Zeichenfolge in einer Gruppe, die durch einen der UnicodeCategory-Werte bezeichnet wird.Categorizes the character at the specified position in a specified string into a group identified by one of the UnicodeCategory values. |
Beispiele
Im folgenden Codebeispiel wird veranschaulicht GetUnicodeCategory .The following code example demonstrates GetUnicodeCategory.
using namespace System;
int main()
{
char ch2 = '2';
String^ str = "Upper Case";
Console::WriteLine( Char::GetUnicodeCategory( 'a' ).ToString() ); // Output: S"LowercaseLetter"
Console::WriteLine( Char::GetUnicodeCategory( ch2 ).ToString() ); // Output: S"DecimalDigitNumber"
Console::WriteLine( Char::GetUnicodeCategory( str, 6 ).ToString() ); // Output: S"UppercaseLetter"
}
using System;
public class GetUnicodeCategorySample {
public static void Main() {
char ch2 = '2';
string str = "Upper Case";
Console.WriteLine(Char.GetUnicodeCategory('a')); // Output: "LowercaseLetter"
Console.WriteLine(Char.GetUnicodeCategory(ch2)); // Output: "DecimalDigitNumber"
Console.WriteLine(Char.GetUnicodeCategory(str, 6)); // Output: "UppercaseLetter"
}
}
Module GetUnicodeCategorySample
Sub Main()
Dim ch2 As Char
ch2 = "2"c
Dim str As String
str = "Upper Case"
Console.WriteLine(Char.GetUnicodeCategory("a"c)) ' Output: "1" (LowercaseLetter)
Console.WriteLine(Char.GetUnicodeCategory(ch2)) ' Output: "8" (DecimalDigitNumber)
Console.WriteLine(Char.GetUnicodeCategory(str, 6)) ' Output: "0" (UppercaseLetter)
End Sub
End Module
GetUnicodeCategory(Char)
Kategorisiert ein angegebenes Unicode-Zeichen in einer Gruppe, die durch einen der UnicodeCategory-Werte bezeichnet wird.Categorizes a specified Unicode character into a group identified by one of the UnicodeCategory values.
public:
static System::Globalization::UnicodeCategory GetUnicodeCategory(char c);
public static System.Globalization.UnicodeCategory GetUnicodeCategory (char c);
static member GetUnicodeCategory : char -> System.Globalization.UnicodeCategory
Public Shared Function GetUnicodeCategory (c As Char) As UnicodeCategory
Parameter
- c
- Char
Das zu kategorisierende Unicode-Zeichen.The Unicode character to categorize.
Gibt zurück
Ein UnicodeCategory-Wert, der die Gruppe bezeichnet, die c
enthält.A UnicodeCategory value that identifies the group that contains c
.
Hinweise
Die- Char.GetUnicodeCategory Methode gibt nicht immer denselben UnicodeCategory Wert wie die-Methode zurück, CharUnicodeInfo.GetUnicodeCategory(Char) Wenn ein bestimmtes Zeichen als Parameter übergeben wird.The Char.GetUnicodeCategory method does not always return the same UnicodeCategory value as the CharUnicodeInfo.GetUnicodeCategory(Char) method when it is passed a particular character as a parameter. Die- CharUnicodeInfo.GetUnicodeCategory(Char) Methode ist so konzipiert, dass Sie die aktuelle Version des Unicode-Standards widerspiegelt.The CharUnicodeInfo.GetUnicodeCategory(Char) method is designed to reflect the current version of the Unicode standard. Obwohl die-Methode in der Char.GetUnicodeCategory Regel die aktuelle Version des Unicode-Standards widerspiegelt, kann Sie die Kategorie eines Zeichens zurückgeben, die auf einer früheren Version des Standards basiert, oder es kann eine Kategorie zurückgeben, die sich vom aktuellen Standard unterscheidet, um die Abwärtskompatibilität aufrechtzuerhalten.In contrast, although the Char.GetUnicodeCategory method usually reflects the current version of the Unicode standard, it may return a character's category based on a previous version of the standard or it may return a category that differs from the current standard in order to preserve backward compatibility. Daher wird empfohlen, anstelle von die-Methode zu verwenden CharUnicodeInfo.GetUnicodeCategory(Char) Char.GetUnicodeCategory(Char) .As a result, we recommend that you use the CharUnicodeInfo.GetUnicodeCategory(Char) method instead of Char.GetUnicodeCategory(Char).
Beginnend mit .NET Framework 4.6.2 werden Unicode-Zeichen basierend auf dem Unicode-Standard, Version 8.0.0,klassifiziert.Starting with .NET Framework 4.6.2, Unicode characters are classified based on The Unicode Standard, Version 8.0.0. In Versionen der .NET Framework von der .NET Framework 4.NET Framework 4 in .NET Framework 4.6.1.NET Framework 4.6.1 werden Sie basierend auf dem Unicode-Standard, Version 6.3.0,klassifiziert.In versions of the .NET Framework from the .NET Framework 4.NET Framework 4 to the .NET Framework 4.6.1.NET Framework 4.6.1, they are classified based on The Unicode Standard, Version 6.3.0.
Siehe auch
Gilt für:
GetUnicodeCategory(String, Int32)
Kategorisiert das Zeichen an der angegebenen Position in einer angegebenen Zeichenfolge in einer Gruppe, die durch einen der UnicodeCategory-Werte bezeichnet wird.Categorizes the character at the specified position in a specified string into a group identified by one of the UnicodeCategory values.
public:
static System::Globalization::UnicodeCategory GetUnicodeCategory(System::String ^ s, int index);
public static System.Globalization.UnicodeCategory GetUnicodeCategory (string s, int index);
static member GetUnicodeCategory : string * int -> System.Globalization.UnicodeCategory
Public Shared Function GetUnicodeCategory (s As String, index As Integer) As UnicodeCategory
Parameter
- index
- Int32
Die Zeichenposition in s
.The character position in s
.
Gibt zurück
Eine UnicodeCategory-Enumerationskonstante, die die Gruppe bezeichnet, die das Zeichen an der Position index
in s
enthält.A UnicodeCategory enumerated constant that identifies the group that contains the character at position index
in s
.
Ausnahmen
s
ist null
.s
is null
.
index
ist kleiner als 0 (null) oder größer als die letzte Position in s
.index
is less than zero or greater than the last position in s
.
Hinweise
Zeichen Positionen in einer Zeichenfolge werden beginnend mit 0 (null) indiziert.Character positions in a string are indexed starting from zero.
Die- Char.GetUnicodeCategory Methode gibt nicht immer denselben UnicodeCategory Wert wie die-Methode zurück, CharUnicodeInfo.GetUnicodeCategory(String, Int32) Wenn ein bestimmtes Zeichen als Parameter übergeben wird.The Char.GetUnicodeCategory method does not always return the same UnicodeCategory value as the CharUnicodeInfo.GetUnicodeCategory(String, Int32) method when it is passed a particular character as a parameter. Die- CharUnicodeInfo.GetUnicodeCategory(String, Int32) Methode ist so konzipiert, dass Sie die aktuelle Version des Unicode-Standards widerspiegelt.The CharUnicodeInfo.GetUnicodeCategory(String, Int32) method is designed to reflect the current version of the Unicode standard. Obwohl die-Methode in der Char.GetUnicodeCategory Regel die aktuelle Version des Unicode-Standards widerspiegelt, kann Sie die Kategorie eines Zeichens zurückgeben, die auf einer früheren Version des Standards basiert, oder es kann eine Kategorie zurückgeben, die sich vom aktuellen Standard unterscheidet, um die Abwärtskompatibilität aufrechtzuerhalten.In contrast, although the Char.GetUnicodeCategory method usually reflects the current version of the Unicode standard, it may return a character's category based on a previous version of the standard or it may return a category that differs from the current standard in order to preserve backward compatibility. Daher wird empfohlen, anstelle von die-Methode zu verwenden CharUnicodeInfo.GetUnicodeCategory(Char) Char.GetUnicodeCategory(String, Int32) .As a result, we recommend that you use the CharUnicodeInfo.GetUnicodeCategory(Char) method instead of Char.GetUnicodeCategory(String, Int32).
Beginnend mit .NET Framework 4.6.2 werden Unicode-Zeichen basierend auf dem Unicode-Standard, Version 8.0.0,klassifiziert.Starting with .NET Framework 4.6.2, Unicode characters are classified based on The Unicode Standard, Version 8.0.0. In Versionen der .NET Framework von der .NET Framework 4.NET Framework 4 in .NET Framework 4.6.1.NET Framework 4.6.1 werden Sie basierend auf dem Unicode-Standard, Version 6.3.0,klassifiziert.In versions of the .NET Framework from the .NET Framework 4.NET Framework 4 to the .NET Framework 4.6.1.NET Framework 4.6.1, they are classified based on The Unicode Standard, Version 6.3.0.