Example

using System;
using System.Globalization;

namespace Samples
{
  public class UnicodeCategorySample
  {
    public static void Main()
    {
      string s = "Pi is (\u03a0)!";
      Console.WriteLine("In string: {0}", s);
      foreach(char c in s)
        Console.WriteLine(
                "Unicode category of Char '{0}' value: {1} is {2}",
                c, (int) c, Char.GetUnicodeCategory(c));
    }
  }
}
The output is
 C In string: Pi is ()! Unicode category of Char 'P' value: 80 is UppercaseLetter Unicode category of Char 'i' value: 105 is LowercaseLetter Unicode category of Char ' ' value: 32 is SpaceSeparator Unicode category of Char 'i' value: 105 is LowercaseLetter Unicode category of Char 's' value: 115 is LowercaseLetter Unicode category of Char ' ' value: 32 is SpaceSeparator Unicode category of Char ...

Get .NET Framework Standard Library Annotated Reference, Volume 1: Base Class Library and Extended Numerics Library now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.