Character Classification Sample

Description

The ctype<T> facet of a given locale is used to classify characters, for example as to whether they represent letters or digits. The is() function classifies individual characters, while scan_is() and scan_not() search for matches in a string.

Concept

The sample program creates a classic locale (the same one as used by C). Then a ctype<char> facet is retrieved from the locale, and along with the ctype_base::digit mask is used to determine whether the character 9 is a digit.

Then the scan_is() function is used to find the first upper case letter in a string, and scan_not() similarly to find the first character that is not an upper case letter.

Supported
Supported
Supported