| 1 | // Boost string_algo library example file ---------------------------------// |
|---|---|
| 2 | |
| 3 | // Copyright Pavol Droba 2002-2003. Use, modification and |
| 4 | // distribution is subject to the Boost Software License, Version |
| 5 | // 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
| 6 | // http://www.boost.org/LICENSE_1_0.txt) |
| 7 | |
| 8 | // See http://www.boost.org for updates, documentation, and revision history. |
| 9 | |
| 10 | #include <string> |
| 11 | #include <vector> |
| 12 | #include <iostream> |
| 13 | #include <iterator> |
| 14 | #include <boost/algorithm/string/case_conv.hpp> |
| 15 | |
| 16 | using namespace std; |
| 17 | using namespace boost; |
| 18 | |
| 19 | int main() |
| 20 | { |
| 21 | cout << "* Case Conversion Example *"<< endl << endl; |
| 22 | |
| 23 | string str1("AbCdEfG"); |
| 24 | vector<char> vec1( str1.begin(), str1.end() ); |
| 25 | |
| 26 | // Convert vector of chars to lower case |
| 27 | cout << "lower-cased copy of vec1: "; |
| 28 | to_lower_copy( Output: ostream_iterator<char>(cout), Input: vec1 ); |
| 29 | cout << endl; |
| 30 | |
| 31 | // Conver string str1 to upper case ( copy the input ) |
| 32 | cout << "upper-cased copy of str1: "<< to_upper_copy( Input: str1 ) << endl; |
| 33 | |
| 34 | // Inplace conversion |
| 35 | to_lower( Input&: str1 ); |
| 36 | cout << "lower-cased str1: "<< str1 << endl; |
| 37 | |
| 38 | cout << endl; |
| 39 | |
| 40 | return 0; |
| 41 | } |
| 42 |
