So, Ive written a chatfilter for this game I do some programming on. It's mostly working, but if the uses adds a space between the abusive word, it doesn't filter it. Was wondering if anyone knew the best way to fix that. I tried using remove_if, but it crashed my program.
Example:
string strMsg = szMsg; //copy contents of szMsg to strMsg (easier to manipulate). szMsg is defined in the function prototype as a char ptr
if (!CheckChatFilter(strMsg.c_str())) //strMsg utilized from here down
{
if (m_nLastAbuseTime < 1 && StrStrI(strMsg.c_str(), MGetChattingFilter()->GetLastFilteredStr().c_str())) //ignore case
{
strMsg.replace(remove_if(MGetChattingFilter()->GetLastFilteredStr().begin(), MGetChattingFilter()->GetLastFilteredStr().end(), ::isspace),MGetChattingFilter()->GetLastFilteredStr().end()); // Crash caused by this
string::size_type pos = strMsg.find(MGetChattingFilter()->GetLastFilteredStr());
if (pos != string::npos)
{
strMsg.replace(pos, MGetChattingFilter()->GetLastFilteredStr().size(), "*beep*");
}