std::vector

Remove certain characters from a String in C++

In this article, we will learn how to remove certain characters from a string in C++. Table Of Contents Problem Description Method 1: Using while loop Method 2: Using STL function for_each(), erase() and remove() Special Notes about remove() and erase() Summary Problem Description Suppose we have a string sampleStr, and an array of characters

Remove certain characters from a String in C++ Read More »

Convert a String to a Vector of Bytes in C++

The article here discusses various ways to convert an input string to a vector of bytes in C++. Table Of Contents Method 1: Using a For Loop Method 2: Using std::vector Constructor Method 3: Using std::transform method Method 4: Using std::copy() method Summary Method 1: Using a For Loop This program creates a string called

Convert a String to a Vector of Bytes in C++ Read More »

vector::pop_back() function in C++

In C++, the vector class provides a function pop_back(). It removes the last element from the calling vector object. Table Of Contents Syntax of vector::pop_back(): Example of vector::pop_back() function Calling vector::pop_back() function on empty vector Remove all elements from vector using vector::pop_back() Summary Syntax of vector::pop_back(): Parameters: None Return value: None It accepts no argument,

vector::pop_back() function in C++ Read More »

Scroll to Top