The code:
Code:
std::string removecharacters(std::string strText)
{
std::string strUnwanted;
int currLoc = 0;
int StringLength = 0;
char tmpChar;
strUnwanted = "~`!@#$%^&*()_-+={}|[]\\:;'<>?,./\"";
StringLength = strUnwanted.length();
for(currLoc=1;currLoc = StringLength;currLoc++)
{
tmpChar = strUnwanted.substr(currLoc, 1);
//const char chtemp = tmpChar????
strText.replace(strText.begin(),strText.end(), tmpChar, "");
}
return strText;
}
:\my stuff\c++\mfprocess\validation.h(62) : error C2664: 'class std::basic_string<char,struct std::char_traits<char>,
class std::allocator<char> > &__thiscall
std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::replace
(unsigned int,unsigned int,const char *,unsigned int)' :
cannot convert parameter 1 from 'char *' to 'unsigned int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
The replace function needs a const where I am passing a string. The string is integral as it's part of the loop looking for different symbols to replace. What should I do?