| Home | Libraries | People | FAQ | More

##### Character Classification Parsers (`alnum`, `digit`, etc.)

###### Description

The library has the full repertoire of single character parsers for character classification. This includes the usual `alnum`, `alpha`, `digit`, `xdigit`, etc. parsers. These parsers have an associated Character Encoding Namespace. This is needed when doing basic operations such as inhibiting case sensitivity.

###### Header

    // forwards to <boost/spirit/home/qi/char/char_class.hpp>
    #include <boost/spirit/include/qi_char_class.hpp>

Also, see Include Structure.

###### Namespace

Name
`ns::alnum`
`ns::alpha`
`ns::blank`
`ns::cntrl`
`ns::digit`
`ns::graph`
`ns::lower`
`ns::print`
`ns::punct`
`ns::space`
`ns::upper`
`ns::xdigit`

In the table above, `ns` represents a Character Encoding Namespace.

###### Model of

> `PrimitiveParser`

Notation

`ns`

  A Character Encoding Namespace.

###### Expression Semantics

Semantics of an expression is defined only where it differs from, or is not defined in `PrimitiveParser`.

Expression | Semantics
--- | ---
`ns::alnum` | Matches alpha-numeric characters
`ns::alpha` | Matches alphabetic characters
`ns::blank` | Matches spaces or tabs
`ns::cntrl` | Matches control characters
`ns::digit` | Matches numeric digits
`ns::graph` | Matches non-space printing characters
`ns::lower` | Matches lower case letters
`ns::print` | Matches printable characters
`ns::punct` | Matches punctuation symbols
`ns::space` | Matches spaces, tabs, returns, and newlines
`ns::upper` | Matches upper case letters
`ns::xdigit` | Matches hexadecimal digits

###### Attributes

> The character type of the Character Encoding Namespace, `ns`.

###### Complexity

> O(N)

###### Example

| Note
The test harness for the example(s) below is presented in the Basics Examples section.

Some using declarations:

    using boost::spirit::ascii::alnum;
    using boost::spirit::ascii::blank;
    using boost::spirit::ascii::digit;
    using boost::spirit::ascii::lower;

Basic usage:

    test_parser("1", alnum);
    test_parser(" ", blank);
    test_parser("1", digit);
    test_parser("a", lower);