Availability:C-language interface function
unsigned int PL_ctype_flags(int
chr)Returns the POSIX character classes of the 32-bit code point chr
as the bitwise or of the constants below, e.g.
if ( PL_ctype_flags(c) & PL_CTYPE_ALPHA )
...
PL_CTYPE_ALNUM | PL_CTYPE_ALPHA
or a numeric character |
PL_CTYPE_ALPHA | Unicode Alphabetic |
PL_CTYPE_CNTRL | general category Cc
or Cf |
PL_CTYPE_DIGIT | 0 ...9,
as POSIX demands |
PL_CTYPE_GRAPH | printable and not white
space |
PL_CTYPE_LOWER | Unicode Lowercase |
PL_CTYPE_PRINT | PL_CTYPE_GRAPH
or white space |
PL_CTYPE_PUNCT | printable, neither alnum
nor space |
PL_CTYPE_SPACE | Unicode White_Space |
PL_CTYPE_UPPER | Unicode Uppercase |
This is the classifier behind code_type/2
and char_type/2
and a locale-independent replacement for the <wctype.h>
functions
iswalpha(), iswspace(), ... Besides not varying with
LC_CTYPE, it does not vary between C libraries (glibc and
Darwin disagree on whether U+00A0 and U+0085 are white space, for
example) and it answers for the full Unicode range also on Windows,
where wint_t is 16 bits and the <wctype.h>
functions silently fail for non-BMP code points.