wmii/lib/libstuff/util/trim.c
2010-06-04 16:46:25 -04:00

20 lines
288 B
C

/* Written by Kris Maglione <maglione.k at Gmail> */
/* Public domain */
#include "util.h"
void
trim(char *str, const char *chars) {
const char *r;
char *p, *q;
for(p=str, q=str; *p; p++) {
for(r=chars; *r; r++)
if(*p == *r)
break;
if(!*r)
*q++ = *p;
}
*q = '\0';
}