conv_example.cpp 1.1 KB

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