It'd look like following, if you simply prefer to use a STL algorithm
#include<algorithm>
std::string line ="ts='TOK_STORE_ID'; one,one, two;four$three two";
std::replace_if(line.begin() , line.end() ,
[] (const char& c) { return std::ispunct(c) ;},' ');
Or if you don't want to use STL
Simply use:
std::string line ="ts='TOK_STORE_ID'; one,one, two;four$three two"; std::size_t l=line.size(); for (std::size_t i=0; i<l; i++) { if (std::ispunct(line[i])) { line[i] = ' '; } }