esp32-lora/test/lora32/components/esp32-uart-cmdr/string-util.c

29 lines
352 B
C
Raw Normal View History

2018-07-28 16:49:13 -04:00
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;
}