From 995fac7e0ce325ada75a6f921926b1f923e28dd0 Mon Sep 17 00:00:00 2001 From: axtloss Date: Sun, 25 Feb 2024 20:24:05 +0100 Subject: add move bvg functions --- fbwarn/src/extString.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'fbwarn/src/extString.c') diff --git a/fbwarn/src/extString.c b/fbwarn/src/extString.c index c93cffd..abe6728 100644 --- a/fbwarn/src/extString.c +++ b/fbwarn/src/extString.c @@ -13,3 +13,22 @@ char *strlwr(char *str) return str; } + +char *trim(char *str) +{ + char *result = strdup(str); + char *end; + + while(isspace((unsigned char)*result)) result++; + + if(*result == 0) + return result; + + end = result + strlen(result) - 1; + while(end > result && isspace((unsigned char)*end)) end--; + + // Write new null terminator character + end[1] = '\0'; + + return result; +} -- cgit v1.2.3