<strings> library in C++ STL Last Updated : 21 Aug, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report Member functions String.constructor : Construct string object (public member function ).String.destructor : String destructor (public member function )String.operator= : String assignment (public member function ) Iterators Begin : Return iterator to beginning (public member function )End : Return iterator to end (public member function )Advance : Increment the iterator position till the specified number mentioned in its arguments.Next : Returns the new iterator that the iterator would point after advancing the positions mentioned in its arguments.Prev() : Returns the new iterator that the iterator would point after decrementing the positions mentioned in its arguments.Inserter : Insert the elements at any position in the container.Rbegin: Return reverse iterator to reverse beginning (public member function )Rend : Return reverse iterator to reverse end (public member function )Cbegin : Return const_iterator to beginning (public member function )Cend : Return const_iterator to end (public member function )Crbegin : Return const_reverse_iterator to reverse beginning (public member function )Crend : Return const_reverse_iterator to reverse end (public member function ) Capacity Size : Return length of string (public member function )Length : Return length of string (public member function )Max_size : Return maximum size of string (public member function )Resize : Resize string (public member function )Capacity : Return size of allocated storage (public member function )Reserve : Request a change in capacity (public member function )Clear : Clear string (public member function )Empty : Test if string is empty (public member function )Shrink_to_fit : Shrink to fit (public member function ) Element access At : Get character in string (public member function )Back : Access last character (public member function )Front : Access first character (public member function ) Modifiers Operator+= : Append to string (public member function )Append : Append to string (public member function )Push_back : Append character to string (public member function )Assign : Assign New value to the string (public member function )Insert : Insert into string (public member function )Erase : Erase characters from string (public member function )Replace : Replace portion of string (public member function )Swap : Swap string values (public member function )Pop_back : Delete last character (public member function ) String operations Operator[]: Get character of string (public member function )C_str : Get C string equivalent (public member function )Data : Get string data (public member function )Get_allocator : Get allocator (public member function )Copy : Copy sequence of characters from string (public member function )Find : Find content in string (public member function )Rfind : Find last occurrence of content in string (public member function )Find_first_of : Find character in string (public member function )Find_last_of : Find character in string from the end (public member function )Find_first_not_of : Find absence of character in string (public member function )Find_last_not_of : Find non-matching character in string from the end (public member function )Substr : Generate substring (public member function )Compare : Compare strings (public member function )sort : Function sorts the elements in ascending order.is_sorted : Checks if the elements in the string (first to last) are sorted in Ascending order.Elements in the string compared using "<" operator. Member constants & Non-member function overloads Npos : Maximum value for size_t (public static member constant )Operator+ : Concatenate strings .Relational operators : Relational operators for string.Swap : Exchanges the values of two strings .Operator>> : Extract string from stream .Operator<< : Insert string into stream .Getline : Get line from stream into string. More Useful Links Recent Articles on C++Coding Practice PlatformMultiple Choice QuestionsAll articles in C++ Category Comment More infoAdvertise with us Next Article <strings> library in C++ STL A ayushmaan bansal Follow Improve Article Tags : Misc C++ cpp-string cpp-strings-library Practice Tags : CPPMisc Similar Reads C++ Programming Language C++ is a computer programming language developed by Bjarne Stroustrup as an extension of the C language. It is known for is fast speed, low level memory management and is often taught as first programming language. It provides:Hands-on application of different programming concepts.Similar syntax to 5 min read SQL Commands | DDL, DQL, DML, DCL and TCL Commands SQL commands are crucial for managing databases effectively. These commands are divided into categories such as Data Definition Language (DDL), Data Manipulation Language (DML), Data Control Language (DCL), Data Query Language (DQL), and Transaction Control Language (TCL). In this article, we will e 7 min read TCP/IP Model The TCP/IP model is a framework that is used to model the communication in a network. It is mainly a collection of network protocols and organization of these protocols in different layers for modeling the network.It has four layers, Application, Transport, Network/Internet and Network Access.While 7 min read Basics of Computer Networking A computer network is a collection of interconnected devices that share resources and information. These devices can include computers, servers, printers, and other hardware. Networks allow for the efficient exchange of data, enabling various applications such as email, file sharing, and internet br 14 min read Object Oriented Programming in C++ Object Oriented Programming - As the name suggests uses objects in programming. Object-oriented programming aims to implement real-world entities like inheritance, hiding, polymorphism, etc. in programming. The main aim of OOP is to bind together the data and the functions that operate on them so th 5 min read Java Programs - Java Programming Examples In this article, we will learn and prepare for Interviews using Java Programming Examples. From basic Java programs like the Fibonacci series, Prime numbers, Factorial numbers, and Palindrome numbers to advanced Java programs.Java is one of the most popular programming languages today because of its 8 min read Unified Modeling Language (UML) Diagrams Unified Modeling Language (UML) is a general-purpose modeling language. The main aim of UML is to define a standard way to visualize the way a system has been designed. It is quite similar to blueprints used in other fields of engineering. UML is not a programming language, it is rather a visual lan 14 min read Second Largest Element in an Array Given an array of positive integers arr[] of size n, the task is to find second largest distinct element in the array.Note: If the second largest element does not exist, return -1. Examples:Input: arr[] = [12, 35, 1, 10, 34, 1]Output: 34Explanation: The largest element of the array is 35 and the sec 14 min read Introduction to Java Java is a high-level, object-oriented programming language developed by Sun Microsystems in 1995. It is platform-independent, which means we can write code once and run it anywhere using the Java Virtual Machine (JVM). Java is mostly used for building desktop applications, web applications, Android 4 min read Python Lists In Python, a list is a built-in dynamic sized array (automatically grows and shrinks). We can store all types of items (including another list) in a list. A list may contain mixed type of items, this is possible because a list mainly stores references at contiguous locations and actual items maybe s 6 min read Like