<strings> library in C++ STL Last Updated : 21 Aug, 2024 Comments Improve Suggest changes 30 Likes 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 Create Quiz Comment A ayushmaan bansal Follow 30 Improve A ayushmaan bansal Follow 30 Improve Article Tags : Misc C++ cpp-string cpp-strings-library Explore C++ BasicsIntroduction to C++3 min readData Types in C++6 min readVariables in C++4 min readOperators in C++9 min readBasic Input / Output in C++3 min readControl flow statements in Programming15+ min readLoops in C++7 min readFunctions in C++8 min readArrays in C++8 min readCore ConceptsPointers and References in C++5 min readnew and delete Operators in C++ For Dynamic Memory5 min readTemplates in C++8 min readStructures, Unions and Enumerations in C++3 min readException Handling in C++12 min readFile Handling in C++8 min readMultithreading in C++8 min readNamespace in C++5 min readOOP in C++Object Oriented Programming in C++8 min readInheritance in C++6 min readPolymorphism in C++5 min readEncapsulation in C++3 min readAbstraction in C++4 min readStandard Template Library(STL)Standard Template Library (STL) in C++3 min readContainers in C++ STL2 min readIterators in C++ STL10 min readC++ STL Algorithm Library3 min readPractice & ProblemsC++ Interview Questions and Answers1 min readC++ Programming Examples4 min read Like