Answers for "how to replace strings in c++"

C++
1

c++ replace

#include <string>

str1.replace(pos,len,str2);
Posted by: Guest on October-05-2021
0

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;
}
Posted by: Guest on October-08-2021

Browse Popular Code Answers by Language