Hello,
This seems like such a basic question, so I apologize if it's already been answered somewhere (my searching didn't turn up anything).
I just want to filter a string object so that it contains only alphanumeric and space characters.
Here's what I tried:
#include "boost/algorithm/string/erase.hpp"
#include "boost/algorithm/string/classification.hpp"
std::wstring oldStr = "Bla=bla =&*\nSampleSampleSample ";
std::wstring newStr = boost::erase_all_copy(oldStr, !(boost::is_alnum() ||
boost::is_space()));
But the compiler is not at all happy with that -- it seems that I can only put a string in the second argument of erase_all_copy
and not this is_alnum()
stuff.
Is there some obvious solution I'm missing here?