Answers for "substr (pos,length)"

C++
0

substr (pos,length)

#include <string.h>
#include <iostream>
using namespace std;
int main(){
    // Take any string
    string s1 = "Geeks";
    // Copy three characters of s1 (starting 
    // from position 1)
    string r = s1.substr(1, 3);
    // prints the result
    cout << "String is: " << r; //String is: eek
    return 0;
}
Posted by: Guest on April-01-2021

Browse Popular Code Answers by Language