c1593e7ea9
- travis with valgrind, cppcheck, ubsan, codecov, covscan (future) - appveyor with MSVC 2010 through 2017, cygwin 32/64, mingw 32/64 - README updated, LICENSE, etc. - Moved documentation into doc/ - Moved examples into example/
30 lines
823 B
C++
30 lines
823 B
C++
// (c) Copyright Jeremy Siek 2002.
|
|
|
|
// Distributed under the Boost Software License, Version 1.0. (See
|
|
// accompanying file LICENSE_1_0.txt or copy at
|
|
// http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
// Sample output:
|
|
//
|
|
// <> <> <Hello> <|> <world> <|> <> <|> <> <foo> <> <bar> <yow> <baz> <|> <>
|
|
|
|
// char_sep_example_2.cpp
|
|
#include <iostream>
|
|
#include <boost/tokenizer.hpp>
|
|
#include <string>
|
|
|
|
int main()
|
|
{
|
|
std::string str = ";;Hello|world||-foo--bar;yow;baz|";
|
|
|
|
typedef boost::tokenizer<boost::char_separator<char> >
|
|
tokenizer;
|
|
boost::char_separator<char> sep("-;", "|", boost::keep_empty_tokens);
|
|
tokenizer tokens(str, sep);
|
|
for (tokenizer::iterator tok_iter = tokens.begin();
|
|
tok_iter != tokens.end(); ++tok_iter)
|
|
std::cout << "<" << *tok_iter << "> ";
|
|
std::cout << "\n";
|
|
return EXIT_SUCCESS;
|
|
}
|