How to get Unicode's "General Category" of a character?
How to get Unicode's "General Category" of a character?
- Subject: How to get Unicode's "General Category" of a character?
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Tue, 07 Jul 2015 19:03:46 +0700
Given a character (a Unicode code point, to be exact) like U+FF0B (FULLWIDTH PLUS SIGN), I want to know the General Category of this.
For this example it would be “Sm" (aka. Math_Symbol or Symbol, Math).
I could download the current version of UnicodeData.txt and parse it.
But this looks not very efficient.
For punctuation one could use NSCharacterSet punctuationCharacterSet.
But for Math Symbols?
I did look at CFStringTransform, which can give the Character name via kCFStringTransformToUnicodeName.
But I cannot find anything for “General Category"
NSRegularExpression can match for [\p{General_Category = Math_Symbol}]; not quite what I want, but better than nothing.
Any ideas?
Gerriet.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden