In this article, we will learn about substr() function in C++ which is used to extract a sub-string from a given string.
What is a String?
A string is a sequence of characters which is used to alter or store text. In C++, string is a datatype which is used to store continuous characters and it ends when they encounter a space or a newline.
The C++ STL(Standard Template Library) provides a string class called 'std::string' that represents a string.
In C++, strings are zero-indexed, so the first c...
Published on December 12, 2022 01:45