0
string.find
ok so you know how you can use string. find to find a word in a sentence. how would i find the word regardless of its capitalization ex: string x = "hello" if (string::npos != x.find("hello")) cout << "string found" << endl; in this example how would i make it so that if string x = "HeLLo, it would still print out string found regardless of the capitalization differences
2 Respuestas
+ 2
you can turn the string to lowercase before you check if you want by either using a for loop to go threw the string and tolower on each char or use transform with tolower.
0
Mooaholic thanks dude that worked perfectly! although i used the ascii table values insteam of tolower. thanks man!