Generation

generate functionSun, 13 Nov 2022

replace substring of a string with a variable

string str = "Hello World!"; // find the first occurrence of "World" size_t pos = str.find("World"); // replace "World" with "New" str.replace(pos, 5, "New");

Questions about programming?Chat with your personal AI assistant