GRASS GIS 7 Programmer's Manual
7.9.dev(2021)-e5379bbd7
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
if
(a != b)
32
while
((*b++ = *a++)) ;
33
34
/* remove trailing white space */
35
for
(a = buf; *a; a++) ;
36
if
(a != buf) {
37
for
(a--; *a ==
' '
|| *a ==
'\t'
; a--) ;
38
a++;
39
*a = 0;
40
}
41
}
dbmi.h
b
double b
Definition:
r_raster.c:39
db_strip
void db_strip(char *buf)
Strip given string.
Definition:
strip.c:25
lib
db
dbmi_base
strip.c
Generated on Mon May 31 2021 05:21:32 for GRASS GIS 7 Programmer's Manual by
1.8.13