Created
August 8, 2018 04:15
-
-
Save ForeverZer0/495d421cc38b02829685e3518eba8aad to your computer and use it in GitHub Desktop.
Function to do basic character replacement in a string.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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