Does locale / codecvt have the correct aspect to check for character specifics

Well, in C ++, the codecvt / locale library has a correct facet that could be used to check if a character is "something"? IE to check if a character is some form of linear character, or is a numeric value or a space, etc. Etc.?

Or do I have to manually use / use a regex for this?

+3


source to share


1 answer


Yes, using a facet std::ctype

and its method is

:

std::use_facet<std::ctype<char>>(std::locale()).is(std::ctype_base::digit, '9');

      



The available classification masks can be found here .

No line break character classification category; for this you need to use ICU u_getIntPropertyValue

with UCHAR_LINE_BREAK

and check for U_LB_MANDATORY_BREAK

etc.

+2


source







All Articles