f0x.at1/Core/Src/helper.c

28 lines
364 B
C
Raw Normal View History

2022-07-15 12:44:08 +02:00
/*
* helper.c
*
* Created on: Jul 14, 2022
* Author: tom
*/
#include <string.h>
#include <ctype.h>
char *ltrim(char *s)
{
while(isspace((int)*s)) s++;
return s;
}
char *rtrim(char *s)
{
char* back = s + strlen(s);
while(isspace((int)*--back));
*(back+1) = '\0';
return s;
}
char *trim(char *s)
{
return rtrim(ltrim(s));
}