Char.GetUnicodeCategory 메서드

정의

유니코드 문자를 UnicodeCategory 값 중 하나로 식별되는 그룹으로 분류합니다.

오버로드

GetUnicodeCategory(Char)

지정한 유니코드 문자를 UnicodeCategory 값 중 하나로 식별되는 그룹으로 분류합니다.

GetUnicodeCategory(String, Int32)

지정된 문자열의 지정된 위치에 있는 문자를 UnicodeCategory 값 중 하나로 식별되는 그룹으로 분류합니다.

예제

다음 코드 예제에서는을 보여 줍니다 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"
    }
}
open System

let ch2 = '2'
let str = "Upper Case"

printfn $"{Char.GetUnicodeCategory 'a'}"        // Output: "LowercaseLetter"
printfn $"{Char.GetUnicodeCategory ch2}"        // Output: "DecimalDigitNumber"
printfn $"{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)

지정한 유니코드 문자를 UnicodeCategory 값 중 하나로 식별되는 그룹으로 분류합니다.

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

매개 변수

c
Char

분류할 유니코드 문자입니다.

반환

UnicodeCategory

UnicodeCategory가 포함된 그룹을 식별하는 c 값입니다.

설명

Char.GetUnicodeCategory메서드는 UnicodeCategory CharUnicodeInfo.GetUnicodeCategory(Char) 특정 문자를 매개 변수로 전달 하는 경우 메서드와 동일한 값을 항상 반환 하지는 않습니다. CharUnicodeInfo.GetUnicodeCategory(Char)메서드는 유니코드 표준의 현재 버전을 반영 하도록 디자인 되었습니다. 반면, Char.GetUnicodeCategory 메서드는 일반적으로 유니코드 표준의 현재 버전을 반영 하지만 이전 버전의 표준에 따라 문자의 범주를 반환 하거나 이전 버전과의 호환성을 유지 하기 위해 현재 표준과 다른 범주를 반환할 수 있습니다. 따라서 대신 메서드를 사용 하는 것이 좋습니다 CharUnicodeInfo.GetUnicodeCategory(Char) Char.GetUnicodeCategory(Char) .

.NET Framework 4.6.2 부터는 유니코드 표준 8.0.0 버전에 따라 유니코드 문자가 분류 됩니다. .NET Framework 4에서 .NET Framework 4.6.1 .NET Framework 버전은 유니코드 표준 6.3.0 버전에 따라 분류 됩니다.

추가 정보

적용 대상

GetUnicodeCategory(String, Int32)

지정된 문자열의 지정된 위치에 있는 문자를 UnicodeCategory 값 중 하나로 식별되는 그룹으로 분류합니다.

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

매개 변수

index
Int32

s의 문자 위치입니다.

반환

UnicodeCategory

UnicodeCategoryindex 위치에 있는 문자가 포함된 그룹을 식별하는 s 열거형 상수입니다.

예외

s이(가) null인 경우

index가 0보다 작거나 s의 마지막 위치보다 큽니다.

설명

문자열의 문자 위치는 0부터 시작 하는 인덱스입니다.

Char.GetUnicodeCategory메서드는 UnicodeCategory CharUnicodeInfo.GetUnicodeCategory(String, Int32) 특정 문자를 매개 변수로 전달 하는 경우 메서드와 동일한 값을 항상 반환 하지는 않습니다. CharUnicodeInfo.GetUnicodeCategory(String, Int32)메서드는 유니코드 표준의 현재 버전을 반영 하도록 디자인 되었습니다. 반면, Char.GetUnicodeCategory 메서드는 일반적으로 유니코드 표준의 현재 버전을 반영 하지만 이전 버전의 표준에 따라 문자의 범주를 반환 하거나 이전 버전과의 호환성을 유지 하기 위해 현재 표준과 다른 범주를 반환할 수 있습니다. 따라서 대신 메서드를 사용 하는 것이 좋습니다 CharUnicodeInfo.GetUnicodeCategory(Char) Char.GetUnicodeCategory(String, Int32) .

.NET Framework 4.6.2 부터는 유니코드 표준 8.0.0 버전에 따라 유니코드 문자가 분류 됩니다. .NET Framework 4에서 .NET Framework 4.6.1 .NET Framework 버전은 유니코드 표준 6.3.0 버전에 따라 분류 됩니다.

추가 정보

적용 대상