Something is wrong in this function. I could have a string that ends with a '?' but it's still included for some reason. For example, "How are you?" It returns 'How', 'are', 'you?' Why does it include the question mark? Thanks.
Code:
vector<String> Split(bool uppercase = false, const char *delims =", .;:'!?@#$%^&*()_+-[]\\|");
Code:
vector<String> String::Split(bool uppercase, const char *delims)
{
vector<String> vColl;
char *p_tok;
char *p = m_p;
p_tok = strtok(p, delims);
while (p_tok != NULL)
{
if (uppercase) {
*p_tok = toupper(*p_tok);
} else {
*p_tok = tolower(*p_tok);
}
vColl.push_back(p_tok);
p_tok = strtok(NULL, delims);
}
return vColl;
}