Skip to content

Instantly share code, notes, and snippets.

@denisdemaisbr
Created December 12, 2023 00:25
Show Gist options
  • Save denisdemaisbr/e6dba843bc07c3999fd777b139ac28e1 to your computer and use it in GitHub Desktop.
Save denisdemaisbr/e6dba843bc07c3999fd777b139ac28e1 to your computer and use it in GitHub Desktop.
c function to replace char in string
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