Skip to content

Instantly share code, notes, and snippets.

@ox1111
Created February 20, 2019 02:53
Show Gist options
  • Select an option

  • Save ox1111/1597a1ad2b46e07e30facb6d60e20f45 to your computer and use it in GitHub Desktop.

Select an option

Save ox1111/1597a1ad2b46e07e30facb6d60e20f45 to your computer and use it in GitHub Desktop.
#include <boost/algorithm/string.hpp>
#include <iostream>
using namespace std;
using namespace boost;
int main( int argc , char ** argv )
{
string str1 = "hello black falcon ab-*-AB-*-aB";
typedef find_iterator<string::iterator> string_find_it;
string_find_it find_it;
for( find_it = make_find_iterator(str1, first_finder("ab", is_iequal()));
find_it != string_find_it();
find_it++)
{
cout << copy_range<std::string>(*find_it) << endl;
}
typedef split_iterator< string::iterator > string_split_it;
string_split_it split_it;
for( split_it = make_split_iterator(str1, first_finder("-*-", is_iequal()));
split_it != string_split_it();
split_it++)
{
cout << copy_range<std::string>(*split_it) << endl;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment