jeudi 28 juillet 2016

string.find() returns true wrongfully

Well the code explains what i am trying to do

auto haystack = wstring(L"REGISTRYMACHINESOFTWAREWOW6432NodeData�Path");
auto needle = wstring(L"WOW6432NodeData�Name");
auto found = haystack.find(needle) != haystack.npos;
cout << found << endl;

it returns true although needle is different than haystack notice the former ends with Path while the latter ends with Name... how could i exactly tell if certain string contains another ?

Aucun commentaire:

Enregistrer un commentaire