while ((pos = str.find(token)) != str.npos)
string searchtoken = "%" + token;  while ((startpos = str.find(searchtoken)) != str.npos)
static void replaceAll(string & str,                       const string & token,                       const string & value){  int pos;  while ((pos = str.find(token)) != str.npos)  {    str.replace(pos, token.length(), value);  }}