The Boost C++ Libraries

Part II. String Handling

The following libraries provide tools to simplify working with strings.

  • Boost.StringAlgorithms defines many algorithms specifically for strings. For example, you will find algorithms to convert strings to lower or upper case.

  • Boost.LexicalCast provides a cast operator to convert a number to a string or vice versa. The library uses stringstreams internally but might be optimized for conversions between certain types.

  • Boost.Format provides a type-safe alternative for std::printf(). Like Boost.LexicalCast, this library uses stringstreams internally. Boost.Format is extensible and supports user-defined types if output stream operators are defined.

  • Boost.Regex and Boost.Xpressive are libraries to search within strings with regular expressions. While Boost.Regex expects regular expressions written as strings, Boost.Xpressive lets you write them as C++ code.

  • Boost.Tokenizer makes it possible to iterate over substrings in a string.

  • Boost.Spirit can be used to develop parsers based on rules similar to Extended Backus-Naur-Form.