adspace
How would you implement a substr() function that extracts a sub string from a given string?
Answer Posted / Bhudev Singh
In C++, you can use the std::string::substr() function to obtain a substring. Here's an example: `std::string s = "hello world"; std::string substr = s.substr(6);`, which will extract the substring starting from the 7th character (index 6) to the end.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers