Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

remove string from string c

#include <string.h>

char *strremove(char *str, const char *sub) {
    size_t len = strlen(sub);
    if (len > 0) {
        char *p = str;
        while ((p = strstr(p, sub)) != NULL) {
            memmove(p, p + len, strlen(p + len) + 1);
        }
    }
    return str;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #remove #string #string
ADD COMMENT
Topic
Name
9+7 =