string substr(uint pos, uint size) const/string

Returns a string object with its contents initialized to a substring of the current object.

This substring is the character sequence that starts at character position pos and has a length of size characters.

When the NPOS constant is used as size, all the characters between pos and the end of the string are used as the initialization substring:

const string str = "quick brown fox";
string quick = str.substr(0, 5);
string fox = str.substr(12, NPOS);

If the value of size would make the substring to span past the end of the current string content, only those characters until the end of the string are used.

The description above has been adapted from the std::string::substr page on cplusplus.com.