hat hat folgenden CodeFinding Zeichenfolge, wenn Suchbegriff White Spaces
std::string str = "stack overflow=Ask Questions";
size_t pos = str.find("stack overflow");
if(pos != string::npos)
cout << "found" << endl; //works as expected
size_t pos1 = str.find("stack Notflow");
if(pos1 != string::npos)
cout << "found" << endl; //this is printed
else
cout << "NOt found" << endl;
In obigem Code wie "Stack Notflow" gefunden wird? Wie kann ich es korrigieren lassen?
funktioniert gut für mich. http://coliru.stacked-crooked.com/a/01e560e605bfacbe – DeiDei
[konnte nicht reproduzieren] (https://ideone.com/TijiCF). Bitte geben Sie [MCVE] (http://stackoverflow.com/help/mcve) an. – MikeCAT