1// (c) Copyright Jeremy Siek 2002.
2
3// Distributed under the Boost Software License, Version 1.0. (See
4// accompanying file LICENSE_1_0.txt or copy at
5// http://www.boost.org/LICENSE_1_0.txt)
6
7// Sample output:
8//
9// <Hello> <world> <foo> <bar> <yow> <baz>
10
11// char_sep_example_1.cpp
12#include <iostream>
13#include <boost/tokenizer.hpp>
14#include <string>
15
16int main()
17{
18 std::string str = ";;Hello|world||-foo--bar;yow;baz|";
19 typedef boost::tokenizer<boost::char_separator<char> >
20 tokenizer;
21 boost::char_separator<char> sep("-;|");
22 tokenizer tokens(str, sep);
23 for (tokenizer::iterator tok_iter = tokens.begin();
24 tok_iter != tokens.end(); ++tok_iter)
25 std::cout << "<" << *tok_iter << "> ";
26 std::cout << "\n";
27 return EXIT_SUCCESS;
28}
29

source code of boost/libs/tokenizer/example/char_sep_example_1.cpp