File tree 1 file changed +24
-0
lines changed
1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include < boost/algorithm/string/trim.hpp>
2
+ #include < boost/algorithm/string/trim_all.hpp>
3
+ #include < iostream>
4
+
5
+ int main (){
6
+ std::string str (" hello world! " );
7
+ std::cout << " original: '" << str << " '" << std::endl;
8
+ std::cout << " trimed from right: '" << boost::trim_right_copy (str) << " '" << std::endl;
9
+ std::cout << " trimed from left: '" << boost::trim_left_copy (str) << " '" << std::endl;
10
+ std::cout << " trimed from left and right: '" << boost::trim_all_copy (str) << " '" << std::endl;
11
+ boost::trim_right (str);
12
+ std::cout << " trimed from right(in-place): '" << str << " '" << std::endl;
13
+ boost::trim_left (str);
14
+ std::cout << " trimed from left(in-place): '" << str << " '" << std::endl;
15
+ }
16
+
17
+ /*
18
+ original: ' hello world! '
19
+ trimed from right: ' hello world!'
20
+ trimed from left: 'hello world! '
21
+ trimed from left and right: 'hello world!'
22
+ trimed from right(in-place): ' hello world!'
23
+ trimed from left(in-place): 'hello world!'
24
+ */
You can’t perform that action at this time.
0 commit comments