I have a string as below:
string str="university";
and i want to take a portion if this str like "versi" and save it to another string how do i do that?
thanks.
I have a string as below:
string str="university";
and i want to take a portion if this str like "versi" and save it to another string how do i do that?
thanks.
Use substr()
member function:
std::string portion = str.substr(start_index, size);
Read the online doc for better understanding. Read an introductory book on C++ as well.
Hope that helps.
Read carefully some documentation about std::string. You want to use the substr member function.