void StringTest::testTrimRightInPlace() { { std::string s = "abc"; assert (trimRightInPlace(s) == "abc"); } { std::string s = " abc "; assert (trimRightInPlace(s) == " abc"); } { std::string s = " ab c "; assert (trimRightInPlace(s) == " ab c"); } }
int main(int argc, char** argv) { string hello(" Hello, world! "); cout << hello << "\n"; string s1(trimLeft(hello)); // "Hello, world! " cout << s1 << "\n"; trimRightInPlace(s1); // "Hello, world!" cout << s1 << "\n"; string s2(trim(hello)); // "Hello, world!" cout << s2 << "\n"; return 0; }