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


Please Help Members By Posting Answers For Below Questions

What is the latest version on c++?

1209


daily Routine of father

1485


What character terminates all character array strings a) b) . c) END

1397


How c functions prevents rework and therefore saves the programers time as wel as length of the code ?

1165


Can union be self referenced?

1267