Replace Last Character of a String in C++

In this article, we will discuss different ways to replace last character of a string with another character in C++. Table Of Contents Using subscript operator Using string::replace() function Using string::at() function Using string::substr() Suppose we have a string like this, We want to replace the last character of this string with character ‘X’. The …

Replace Last Character of a String in C++ Read More »

Replace First Character in a string in C++

In this article, we will discuss different ways to replace first character of a string with another character in C++. Table Of Contents Using subscript operator Using string::replace() function Using string::at() function Using string::substr() Suppose we have a string like this, We want to replace the first character of this string with character ‘X’. The …

Replace First Character in a string in C++ Read More »

Scroll to Top