Generation

generate functionMon, 23 Jan 2023

how to replace a string

string replacestring(string str, string old, string new){ while (str.find(old) != string::npos){ str.replace(str.find(old), old.size(), new); } return str; } string str("I will replace every 'o' with 'a'."); replacestring(str, "o", "a");

Questions about programming?Chat with your personal AI assistant