如果字符串中的字符不是字母或撇号,则返回false。你知道为什么它不起作用吗?有没有更好的方法让我写出来呢?我正试着像一个C++纯化者一样编写代码。
for (std::string::const_iterator it = S.begin(); it != S.end(); ++it)
if ((*it < 'a' || *it >'z') && (*it > 'A' || *it < 'Z') && (*it != ''''))
return false;发布于 2014-03-03 04:52:30
我看到两个错误:
''''应为'\''.*it > 'A' || *it < 'Z'应为*it < 'A' || *it > 'Z'.https://stackoverflow.com/questions/22133294
复制相似问题