Skip to content

Instantly share code, notes, and snippets.

@ForeverZer0
Created August 8, 2018 04:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ForeverZer0/495d421cc38b02829685e3518eba8aad to your computer and use it in GitHub Desktop.
Save ForeverZer0/495d421cc38b02829685e3518eba8aad to your computer and use it in GitHub Desktop.
Function to do basic character replacement in a string.
char* replace_char(char* str, char find, char replace){
char *pos = strchr(str,find);
while (pos)
{
*pos = replace;
pos = strchr(pos,find);
}
return str;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment