Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR 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;
}
 
PREVIOUS NEXT
Tagged: #replace #part #string #string
ADD COMMENT
Topic
Name
7+9 =