Example 1 — Basic substr()
Take from index 5 to end.
#include <iostream>
#include <string>
int main() {
std::string s = "Hello World";
std::cout << s.substr(6) << '\\n';
return 0;
} How It Works
- Index 6 starts at
'W'. - No length means “to the end”.
- New string is
"World".

