Skip to content

Instantly share code, notes, and snippets.

View JonahRileyHuggins's full-sized avatar

Jonah Riley Huggins JonahRileyHuggins

View GitHub Profile
@mdukat
mdukat / preplace.cpp
Last active October 30, 2025 22:50
Python-like string replace method for C++
#include <iostream>
#include <string>
int preplace(std::string& input, const std::string& a, const std::string& b){
size_t index;
int n = 0;
while((index = input.find(a,0)) != std::string::npos){
input.replace(index, a.size(), b);
n++;
}