Search
 
SCRIPT & CODE EXAMPLE
 

CPP

how to replace part of string with new string c++

//String Replacement
#include <string>

int main(){
  //String before replacement
  string str = "We want to replace all of you";
  //use this inbuilt function
  str.replace(19,10,"me");
    
  cout<<str;
   
  return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: stl function to reverse an array 
Cpp :: define vector with size and value c++ 
Cpp :: c++ template 
Cpp :: length of a string c++ 
Cpp :: sum array c++ 
Cpp :: run c++ program mac 
Cpp :: kmp algorithm c++ 
Cpp :: overload subscript operator cpp 
Cpp :: looping in map c++ 
Cpp :: substring in c++ 
Cpp :: vector from angle 
Cpp :: how to get euler constant in c++ 
Cpp :: Chocolate Monger codechef solution in c++ 
Cpp :: c++ remove all elements equal to 
Cpp :: program to swap max and min in matrix 
Cpp :: initialize 2d vector c++ 
Cpp :: put function in cpp 
Cpp :: Euler constant 
Cpp :: c++ call by value 
Cpp :: count number of char in a string c++ 
Cpp :: hide window c++ 
Cpp :: time complexity of sorting algorithms 
Cpp :: c++ hash 
Cpp :: if in c++ 
Cpp :: split text c++ 
Cpp :: C++ switch..case Statement 
Cpp :: c++ visual studio 
Cpp :: Round 1 Confusion codechef solution in c++ 
Cpp :: heapsort 
Cpp :: curl upload folder and subfolders 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =