Test :
calling following:
remove(strRet.begin(), strRet.end(), '\n');
|
strRet is a std::string containing newline
It's not working!!!!!!!!!!!
if someone print it out....
Reson:
The function cannot alter the properties of the object containing the range of elements (i.e., it cannot alter the size of an array or a container)Solution:
strRet.erase(remove(strRet.begin(), strRet.end(), '\n'), strRet.end());
|
1. Calling remove and get a new end of std::string
2. Erase the removed part
沒有留言:
張貼留言