Skip to content

Instantly share code, notes, and snippets.

@Yangff
Last active June 22, 2017 02:48
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 Yangff/817696090ef80405c03c487a96f95203 to your computer and use it in GitHub Desktop.
Save Yangff/817696090ef80405c03c487a96f95203 to your computer and use it in GitHub Desktop.
void del_substr(char *str, const char *substr) {
for (int i = 0, j = 0; *str; str += !!*(substr+j)) {
for (j = 0; *(str+i+j) == *(substr+j) && *(substr+j); j++);
*str = *(str+i);
i += !*(substr+j) * j;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment