|
/* Copy from blank padded, not zero terminated string "src", * with length "len", into C string "dst", skip trailing * blanks and null terminate "dst" */ void Trim(char * dst, char * src, short len) { char done_with_spaces = 0;
dst += len; src += len;
*dst = 0; while(len--) { dst --; src --; if(!done_with_spaces) { if(*src == ' ') *dst = 0; else { *dst = *src; done_with_spaces = 1; continue; } } else { *dst = *src; } } }
|