+ 2
Find character in a string by it's sequence in c++
Could anyone tell me please that how to find a character in a string by it's sequence in c++? I know the function std::string::find, but it's for finding the location of a char, and I would like to find a char by it's location. I am using the MinGW compiler
4 Answers
+ 4
Can you elaborate more on what you meant by finding character by its sequence here? I'm not understanding your question very well here. Btw, The std::string::find method has an overload for basic_string too, check the reference:
http://en.cppreference.com/w/cpp/string/basic_string/find
+ 2
Thank you guys!
+ 1
Strings have the [], like arrays do. Just do stringName[index] to get the char
+ 1
std::string::at returns the char at a specified position. Square brackets can also be used to access a char at a certain position