29 lines
352 B
C
29 lines
352 B
C
|
void trim_leading(char *str) {
|
||
|
char *i = str;
|
||
|
char *j = str;
|
||
|
|
||
|
while(*j != 0)
|
||
|
if(*++j != ' ') break;
|
||
|
|
||
|
while(*j != 0)
|
||
|
*i++ = *j++;
|
||
|
|
||
|
*i = 0;
|
||
|
}
|
||
|
|
||
|
void trim_multi(char *str) {
|
||
|
char *i = str;
|
||
|
char *j = str;
|
||
|
|
||
|
while(*j != 0) {
|
||
|
*i = *j++;
|
||
|
|
||
|
if(
|
||
|
(*j != ' ') ||
|
||
|
(*j == ' ' && *(j - 1) != ' ')
|
||
|
) i++;
|
||
|
}
|
||
|
|
||
|
*i = 0;
|
||
|
}
|