C# Char GetUnicodeCategory(Char)

Description

Char GetUnicodeCategory(Char) categorizes a specified Unicode character into a group identified by one of the UnicodeCategory values.

Syntax

Char.GetUnicodeCategory(Char) has the following syntax.


public static UnicodeCategory GetUnicodeCategory(
  char c
)

Parameters

Char.GetUnicodeCategory(Char) has the following parameters.

  • c - The Unicode character to categorize.

Returns

Char.GetUnicodeCategory(Char) method returns A UnicodeCategory value that identifies the group that contains c.

Example

The following code example demonstrates GetUnicodeCategory.


/*  w  w  w.  j a v a  2 s  .  com*/
using System;

public class MainClass {
  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"
  }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version