Name

ctype_base class — Base class for ctype facet

Synopsis

class ctype_base{
public:
  enum mask {
    space, print, cntrl, upper, lower, alpha, digit, punct, xdigit,
    alnum=alpha|digit, graph=alnum|punct
  };
};

The ctype_base class is the base class for the ctype and ctype_byname class templates. It declares the mask enumerated type, which is used for classifying characters. Table 13-20 describes the mask literals and their definitions for the classic "C" locale.

Table 13-20. mask literals for classifying characters

Literal

Description

“C” locale

alpha

Alphabetic (a letter)

lower or upper

alnum

Alphanumeric (letter or digit)

alpha or digit

cntrl

Control (nonprintable)

Not print

digit

'0'-'9'

All locales

graph

Character that occupies graphical space

print but not space

lower

Lowercase letter

'a'-'z'

print

Printable character (alphanumeric, punctuation, space, etc.)

Depends on character set; in ASCII: '\x20'-'\x7e')

space

Whitespace

' ', '\f', '\n', '\r', '\t', '\v'

upper

Uppercase letter

'A'-'Z'

xdigit

Hexadecimal digit ('0'-'9', 'a'-'f', 'A'-'F')

All locales

Get C++ In a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.