Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/tokenizer/char_sep_example_1.cpp @ 30

Last change on this file since 30 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 757 bytes
Line 
1// © 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}
Note: See TracBrowser for help on using the repository browser.