Varun

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 »

Replace all characters in string with asterisks – Python

In this article, we will discuss different ways to replace all characters in a string with asterisks i.e. “*”. Table Of Contents Using len() function By converting into list Suppose we have a string like this, After replacing all characters in this string with asterisks, the final string should be like, Number of asterisks in …

Replace all characters in string with asterisks – Python Read More »

Scroll to Top