Write remove_if" and isspace
in <algorithm>
. Additionally, <algorithm>
cannot change the container by itself, so if you attach string::erase
,
str.erase(remove_if(str.begin(), str.end(), isspace), str.end());
© 2024 OneMinuteCode. All rights reserved.