//
// g++ t1.cpp
//
#include <boost/algorithm/string/case_conv.hpp>
#include <iostream>
#include <string>
using namespace std;
main(){
string str("hello world");
boost::to_upper( str);
std::string str1 = boost::to_upper_copy( str);
// the length
cout << "length " << str.length() << endl;
// copy
string dest = str;
str = "";
cout << "dest: " << dest << endl;
// appending
str = "hello world";
str += " und guten tag";
cout << "str: " << str << endl;
// compare and assign
string usbPort( "/dev/ttyUSB0");
if( usbPort.compare( "/dev/ttyUSB0") == 0)
{
usbPort.assign( "/dev/ttyUSB1");
}
}
/*
output:
length 11
dest: HELLO WORLD
str: hello world und guten tag
*/