How to Extract string?

Hi,

I have string object,

string s1="abcdefghijk";

And I want to extract some part of string into the other string. e.g. extract 'def' into the string s2.

Is there any function to extract the string. I have included 'string.h' file.
I want the function which can extract string by mentioning the starting index and length of string or ending index.

string s2 = s1.substr(4,3);

Thank you very much !