Answers for "c++ find letter in string"

C++
1

locate specific string letters c++

string str ("There are two needles in this haystack.");
string str2 ("needle");

if (str.find(str2) != string::npos) {
//.. found.
}
Posted by: Guest on January-09-2022
3

find character in string c++

auto char_to_find = 'a'
if (str.find(char_to_find) != std::string::npos) {
    // character found
}
Posted by: Guest on September-15-2020

Code answers related to "c++ find letter in string"

Browse Popular Code Answers by Language