Created
December 12, 2023 00:25
-
-
Save denisdemaisbr/e6dba843bc07c3999fd777b139ac28e1 to your computer and use it in GitHub Desktop.
c function to replace char in string
This file contains 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
static void str_replace(void *s, unsigned char target, unsigned char to) { | |
unsigned char* str = (unsigned char*) s; | |
while (*str) { | |
if (*str == target) { | |
*str = to; | |
} | |
str++; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment