コード例 #1
0
// except for apostrophe, replace punctuation by a space
// apostrophe is special: it might precede by 's, which is a suffix
void TextQuery::strip_punct(string &line)
{
    for (str_size pos = 0; pos != line.size(); ++pos)
        if (ispunct(line[pos])) {
             if (line[pos] != '\'') line[pos] = ' ';
        }
}
コード例 #2
0
ファイル: TextQuery.cpp プロジェクト: Larry955/learnCPP
string TextQuery::cleanup_str(const string &word)
{
	string ret;
	for (auto it = word.begin(); it != word.end(); ++it)
		if (!ispunct(*it))
			ret += tolower(*it);
	return ret;
}
コード例 #3
0
ファイル: TextQuery.cpp プロジェクト: LukeDream/C---exercise
string TextQuery::cleanup_str(const string &word)
{
    string ret;
    for (string::const_iterator it = word.begin(); it != word.end(); ++it) {
        if (!ispunct(*it))
            ret += tolower(*it);
    }
    return ret;
}