c++ check string char code example
Example 1: index string c++
#include <string>
#include <iostream>
int main(){
//index string by using brackets []
std::string string = "Hello, World!";
//assign variable to string index
char stringindex = string[2];
}
Example 2: check if char in string c++
std::string s = "hell[o";
if (s.find('[') != std::string::npos)
; // found
else
; //