It returns a reference to the character at position pos in the string.
DeclarationFollowing is the declaration for std::string::at.
char& at (size_t pos);C++11
const char& at (size_t pos) const;Parameters
pos − Value with the position of a character within the string.
Return ValueIt returns a reference to the character at position pos in the string.
Exceptionsif an exception is thrown, there are no changes in the string.
ExampleIn below example for std::string::at.
#include <iostream> #include <string> int main () { std::string str ("Sairamkrishna Mammahe"); for (unsigned i=0; i<str.length(); ++i) { std::cout << str.at(i); } return 0; }
Sairamkrishna Mammahe
string.htm
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4