Form : s.substr (p, n)
Returns a string, the string s containing n characters copied from the beginning of p (the default value of p is 0, the default value of n is s.size () - p, i.e., without copying the entire default parameters s)
. 1 int main () 2 { . 3 String A; . 4 String s ( " 123456789 " ); 5 . 6 A s.substr = ( 0 , 5 ); // copy length of the string s starting from bit 0 of 5 string . 7 COUT A << << endl; // output 12345 . 8 . 9 A = s.substr (); // without copying the entire string is the default parameter S 10 COUT A << << endl; // output 123456789 . 11 12 is A = s.substr ( . 4 ); // output 56789 13 is A << endl << COUT; // single parameter default bit string copied from the beginning to the end of 4 14 }