How can I copy a substring from a given string with start and end index or giving the start index and length of the string are given.
std::string thesub = thestring.substr(start, length);
or
std::string thesub = thestring.substr(start, end-start+1);
assuming you want the end
th character to be included in the substring.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With