October 21, 2015

On 10/20/2015 10:38 AM, Charles Hixson via Digitalmars-d-learn wrote:
> In std.uni (D Lib 2.068.2) I can no longer see how to get the general category code for a character.  Does anyone know what the currently supported way to do that is?
>
I thought I remembered that I used to be able to directly get the general character category, but as a crutch this is what I'm using (and checking back to 2012 I apparently couldn't do better then):
char    charCat (dchar ch)
{  if    (isAlpha (ch) )            return    'L';
    if    (isNumber (ch) )        return    'N';
    if    (isWhite (ch) )            return    'Z';
    if    (isControl (ch) )         return    'C';
    if    (isPunctuation (ch) )  return    'P';
    else                                  return    '?';    // Includes not a character
}

This suffices for my current needs, but it clearly a lot less information than the two letter code would be, and sometimes that's what I need.