Preview:
#include<iostream>
using namespace std;

int main(){

//finding the length of the string

    string para = "I am Rishi";
    cout << para.length() << endl;

//finding according to the index of the string

    cout << para[2] << endl;

// replacing a string

    para[0] = 'G';
    cout << para << endl;

//substring

    cout  << para.substr(3, 4);

// creating another variable for the substring

    string parasub = para.substr(3, 4);
    cout << parasub << endl;

    return 0;
}

downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter