본문 바로가기
C++/0x02-boost

boost find

by SpeeDr00t 2016. 8. 1.
반응형

boost find

1.소스

#include <boost/algorithm/string.hpp>
#include <iostream>

using namespace std;
using namespace boost;

int main( int argc , char ** argv )
{
    char text[] = "hello black falcon ab";
    iterator_range< char * > result = find_last( text , "ab");

    transform( result.begin() , result.end() , result.begin() , bind2nd( plus<char>() , 1 ) );

    cout << "text = " << text << endl;
    cout << "result = " << result << endl;


    to_upper( result );
    cout << "to_upper( result ) = " <<  result << endl;

    cout << "text = " << text << endl;

    if( find_first( text , "falcon" ) )
    {
        cout << " Falcon is there" << endl;
    }
}

결과

hacker@ubuntu:~/cpp$ 
hacker@ubuntu:~/cpp$ 
hacker@ubuntu:~/cpp$ 
hacker@ubuntu:~/cpp$ c++ -I /home/hacker/boost_1_61_0 -o boost_find1  boost_find1.cpp
hacker@ubuntu:~/cpp$ 
hacker@ubuntu:~/cpp$ 
hacker@ubuntu:~/cpp$ ./boost_find1 
text = hello black falcon bc
result = bc
to_upper( result ) = BC
text = hello black falcon BC
 Falcon is there
hacker@ubuntu:~/cpp$ 
hacker@ubuntu:~/cpp$ 
반응형

'C++ > 0x02-boost' 카테고리의 다른 글

boost c++ 라이브러리 사용하기 ][ find iterator  (0) 2016.08.01
boost replace  (0) 2016.08.01
boost trimming  (0) 2016.08.01
boost helloworld  (0) 2016.08.01
boost example2  (0) 2016.08.01