GRASS GIS 7 Programmer's Manual
7.9.dev(2021)-e5379bbd7
Main Page
Related Pages
+
Data Structures
Data Structures
Class Hierarchy
+
Data Fields
+
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
~
+
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Related Functions
+
Files
File List
+
Globals
+
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
w
x
y
+
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
o
p
r
s
t
u
v
w
y
z
+
Enumerations
a
c
d
e
h
l
m
n
o
p
r
s
t
v
y
+
Enumerator
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
+
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
•
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
trim_dec.c
Go to the documentation of this file.
1
/*!
2
* \file lib/gis/trim_dec.c
3
*
4
* \brief GIS Library - Trim string decimal functions.
5
*
6
* (C) 2001-2009 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 Original author CERL
12
*/
13
14
#include <string.h>
15
#include <
grass/gis.h
>
16
17
/*!
18
* \brief Removes trailing zeros from decimal number.
19
*
20
* Example: 23.45000 would come back as 23.45
21
*
22
* \param[in,out] buf
23
*/
24
void
G_trim_decimal
(
char
*buf)
25
{
26
char
*mark;
27
28
/* don't trim e+20 into e+2 */
29
if
( strchr(buf,
'e'
) || strchr(buf,
'E'
) )
30
return
;
31
32
/* find the . */
33
while
(*buf !=
'.'
)
34
if
(*buf++ == 0)
35
return
;
36
37
mark = buf;
38
while
(*++buf)
39
if
(*buf !=
'0'
)
40
mark = buf + 1;
41
*mark = 0;
42
}
G_trim_decimal
void G_trim_decimal(char *buf)
Removes trailing zeros from decimal number.
Definition:
trim_dec.c:24
gis.h
lib
gis
trim_dec.c
Generated on Mon May 31 2021 05:21:32 for GRASS GIS 7 Programmer's Manual by
1.8.13