반응형
boost helloworld
1.소스
#include <boost/algorithm/string.hpp> #include <iostream> using namespace std; using namespace boost; int main( int argc , char ** argv ) { string str1(" hello world! "); to_upper(str1); // str1 == " HELLO WORLD! " trim(str1); // str1 == "HELLO WORLD!" cout << " str1 = " << str1 << endl; string str2= to_lower_copy( ireplace_first_copy( str1,"hello","goodbye")); // str2 == "goodbye world!" cout << " str2 = " << str2 << endl; }
결과
hacker@ubuntu:~/cpp$ hacker@ubuntu:~/cpp$ hacker@ubuntu:~/cpp$ c++ -I /home/hacker/boost_1_61_0 -o boost_ex3 boost_ex3.cpp hacker@ubuntu:~/cpp$ hacker@ubuntu:~/cpp$ ./boost_ex3 str1 = HELLO WORLD! str2 = goodbye world! hacker@ubuntu:~/cpp$
반응형
'C++ > 0x02-boost' 카테고리의 다른 글
boost replace (0) | 2016.08.01 |
---|---|
boost find (0) | 2016.08.01 |
boost trimming (0) | 2016.08.01 |
boost example2 (0) | 2016.08.01 |
boost example (0) | 2016.08.01 |