GRASS 8 Programmer's Manual 8.6.0dev(2026)-c83afef6d3
Loading...
Searching...
No Matches
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 SPDX-FileCopyrightText: 1999-2009, 2011 GRASS Development Team
7 SPDX-License-Identifier: GPL-2.0-or-later
8
9 \author Joel Jones (CERL/UIUC), Radim Blazek
10 \author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
11 */
12
13#include <grass/dbmi.h>
14
15/*!
16 \brief Strip given string
17
18 'buf' is rewritten in place with leading and trailing white
19 space removed.
20
21 \param buf string buffer
22 */
23void db_strip(char *buf)
24{
25 char *a, *b;
26
27 /* remove leading white space */
28 for (a = b = buf; *a == ' ' || *a == '\t'; a++)
29 ;
30 if (a != b)
31 while ((*b++ = *a++))
32 ;
33
34 /* remove trailing white space */
35 for (a = buf; *a; a++)
36 ;
37 if (a != buf) {
38 for (a--; *a == ' ' || *a == '\t'; a--)
39 ;
40 a++;
41 *a = 0;
42 }
43}
Main header of GRASS DataBase Management Interface.
double b
Definition r_raster.c:37
void db_strip(char *buf)
Strip given string.
Definition strip.c:23