GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-36359e2344
strip.c
Go to the documentation of this file.
1 /*!
2  \file lib/db/dbmi_base/strip.c
3 
4  \brief DBMI Library (base) - strip strings
5 
6  (C) 1999-2009, 2011 by the GRASS Development Team
7 
8  This program is free software under the GNU General Public License
9  (>=v2). Read the file COPYING that comes with GRASS for details.
10 
11  \author Joel Jones (CERL/UIUC), Radim Blazek
12  \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
13  */
14 
15 #include <grass/dbmi.h>
16 
17 /*!
18  \brief Strip given string
19 
20  'buf' is rewritten in place with leading and trailing white
21  space removed.
22 
23  \param buf string buffer
24  */
25 void db_strip(char *buf)
26 {
27  char *a, *b;
28 
29  /* remove leading white space */
30  for (a = b = buf; *a == ' ' || *a == '\t'; a++)
31  ;
32  if (a != b)
33  while ((*b++ = *a++))
34  ;
35 
36  /* remove trailing white space */
37  for (a = buf; *a; a++)
38  ;
39  if (a != buf) {
40  for (a--; *a == ' ' || *a == '\t'; a--)
41  ;
42  a++;
43  *a = 0;
44  }
45 }
double b
Definition: r_raster.c:39
void db_strip(char *buf)
Strip given string.
Definition: strip.c:25