C++ String rend()30 Aug 2024 | 1 min read The rend() function stands for reverse end. This function points to the first character of the string. SyntaxConsider a string 'str' and reverse iterator 'ritr'. Syntax would be: ParameterThis function does not contain any parameter. Return valueIt returns a reverse iterator pointing to the beginning of the string. ExampleLet's see the simple example. Output: dlroW olleH In this example, we get the reverse string using rend() function. Next TopicC++ Strings |
C++ String pop_back() This function is used to remove a last character of a string, decreasing its length by one. Syntax Consider a string str. Syntax would be : str.pop_back(); Parameters This function does not contain any parameter. Return value This function does not return any value. Example 1 Let's see the simple example. #include<iostream> using namespace std; int...
1 min read
C++ String cend() This function gives a reference to the last character of the string. Difference b/w end() and cend() The only difference between end() and cend() function is, cend() returns the constant iterator pointing to the constant value. Syntax Consider a string str. Syntax would be: str.cend(); Parameter This function does not contain...
1 min read
C++ String size() This function is used to return the length of the string in terms of bytes. It defines the actual number of bytes that conform to the contents of the string object which is not necessarily equal to the capacity. Syntax Consider a string object named...
1 min read
C++ String clear() This function removes the elements, becomes an empty string. Syntax Consider a string str. Syntax would be: str.clear(); Parameter This function does not contain any parameter. Return value This function does not return any value. Example Let's see a simple example of clear() function: #include<iostream> using namespace std; int main() { stringstr; cout<<?Enter some lines about javaTpoint and...
1 min read
C++ String find_last_of() This function searches the string for the last character that matches any of the character specified in the string. Syntax Consider two strings str1 and str2. Syntax would be : str1.find_last_of(str2); Parameters str : str is the string to be used in searching. pos : It defines the position at...
1 min read
C++ String compare() This function compares the value of the string object to the sequence of characters specified by its parameter. Syntax : Suppose str1 and str2 are two strings and we want to compare these two strings then its syntax would look like: int k= str1.compare(str2); k==0 : If k...
2 min read
C++ String length() This function is used to find the length of the string in terms of bytes. This is the actual number of bytes that conform the contents of the string , which is not necessarily equal to the storage capacity. Syntax int len = s1.length(); Parameters This function contains single...
1 min read
C++ String end() This function is used to return an iterator pointing to the last character of the string. Syntax Consider a string 'str' and an iterator 'it'. Syntax would be: iterator it = str.end(); Parameter This function does not contain any parameter. Return value It returns an iterator pointing to the end of...
1 min read
C++ String crbegin() The crbegin() function stands for 'reverse beginning'. This function references to the last character of the string. Syntax Consider a string str. Syntax would be: str.crbegin(); Parameter This function does not contain any parameter. Return value This function returns the constant iterator pointing to the last character of the string. Example 1 Let's...
1 min read
C++ String find_first_not_of() This function is used to search the string for the first character that does not match any of the characters specified in the string. Syntax Consider two strings str1 and str2. Syntax would be : str1.find_first_not_of(str2); Parameters str : str is the string to be used in searching. pos :...
1 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India