Use substr "to-end-of-string" option - C++ STL

C++ examples for STL:string

Description

Use substr "to-end-of-string" option

Demo Code

#include <iostream> 
#include <string> 
using namespace std; 

int main() // ww w  .  j av a 2  s. c o m
{ 
    string s1( "happy test test test test " ); 
    string s2( " birthday test test test test " ); 
    string s3; 

   // 
   cout << "The substring of s1 starting at\n" 
       << "location 15, s1.substr(15), is:\n" 
       << s1.substr( 15 ) << endl; 
}

Result


Related Tutorials