diff common/strhelp.c @ 133:c719d3fdbc15

Added functrion to trim white space from string.
author Sascha Wilde <wilde@intevation.de>
date Mon, 24 Mar 2014 15:11:47 +0100
parents 9104b1b2e4da
children 5f830969e4a1
line wrap: on
line diff
--- a/common/strhelp.c	Mon Mar 24 13:35:20 2014 +0100
+++ b/common/strhelp.c	Mon Mar 24 15:11:47 2014 +0100
@@ -123,3 +123,14 @@
   else
     return false;
 }
+
+void
+str_trim (char **s)
+{
+  size_t i;
+  while (isspace(**s))
+    (*s)++;
+  i = strlen(*s);
+  while (isspace((*s)[--i]))
+    (*s)[i] = '\0';
+}

http://wald.intevation.org/projects/trustbridge/