Ticket #10131: main.cpp

File main.cpp, 713 bytes (added by wburkhardt@…, 8 years ago)

Example to demonstrate the asterisk bug in string_algo

Line 
1
2#include <iostream>
3#include <boost/algorithm/string.hpp>
4#include <boost/algorithm/string/trim_all.hpp>
5
6using namespace std;
7using namespace boost;
8
9int main()
10{
11 string test_sequence("TEST_**???***_TEST");
12 cout << "test_sequence: " << test_sequence << endl;
13
14 string trimmed1 = trim_all_copy_if(test_sequence, is_any_of("\\/:*?\"<>|"));
15 cout << "trim_all_copy_if(): " << trimmed1 << endl;
16
17 string trimmed2 = trim_all_copy_if(test_sequence, is_any_of("\\/:\\*?\"<>|"));
18 cout << "trim_all_copy_if(): " << trimmed2 << endl;
19
20 string trimmed3 = trim_fill_copy_if(test_sequence, "", is_any_of("\\/:*?\"<>|"));
21 cout << "trim_fill_copy_if(,\"=\"): " << trimmed3 << endl;
22
23 return 0;
24}
25