| 1 | // |
|---|---|
| 2 | // StringTokenizer.cpp |
| 3 | // |
| 4 | // This sample demonstrates the usage of the StringTokenizer class. |
| 5 | // |
| 6 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. |
| 7 | // and Contributors. |
| 8 | // |
| 9 | // SPDX-License-Identifier: BSL-1.0 |
| 10 | // |
| 11 | |
| 12 | |
| 13 | #include "Poco/StringTokenizer.h" |
| 14 | #include <iostream> |
| 15 | |
| 16 | |
| 17 | using Poco::StringTokenizer; |
| 18 | |
| 19 | |
| 20 | int main(int argc, char** argv) |
| 21 | { |
| 22 | std::string tokens = "white; black; magenta, blue, green; yellow"; |
| 23 | StringTokenizer tokenizer(tokens, ";,", StringTokenizer::TOK_TRIM); |
| 24 | for (StringTokenizer::Iterator it = tokenizer.begin(); it != tokenizer.end(); ++it) |
| 25 | { |
| 26 | std::cout << *it << std::endl; |
| 27 | } |
| 28 | return 0; |
| 29 | } |
| 30 |