Are there any equivalents for the char functions (ispace, isalpha, etc) defined in <ctype>
for char32_t
?
I had a look around & could only see iswspace (& related) which seem like those are for 16bit chars.
Note: while isspace takes a int as a parameter it seems to produce erroneous results for Unicode characters.
Example:
char32_t dagger = U'';
if (isspace(dagger)) {
puts("That is a space!");
}
Will output "That is a space!"
Up to
wchar_t
you can use std::isalpha with the suitable locale defined in in<locale>
.For anything above 0xFFFF you will need the ICU library:
u_isalpha or u_isUAlphabetic
u_isspace or u_isUWhiteSpace
Full list of functions: uchar.h