1// string::substr
2#include <iostream>
3#include <string>
4
5int main ()
6{
7  std::string str="We think in generalities, but we live in details.";
8                                           // (quoting Alfred N. Whitehead)
9
10  std::string str2 = str.substr (3,5);     // "think"
11
12  std::size_t pos = str.find("live");      // position of "live" in str
13
14  std::string str3 = str.substr (pos);     // get from "live" to the end
15
16  std::cout << str2 << ' ' << str3 << '\n';
17
18  return 0;
19}