character string c++ code example
Example 1: find character in string c++
auto char_to_find = 'a'
if (str.find(char_to_find) != std::string::npos) {
// character found
}
Example 2: c++ read each char of string
std::string str = ???;
for(std::string::iterator it = str.begin(); it != str.end(); ++it) {
do_things_with(*it);
}
Example 3: working with char and string c++
String and Char