GRASS GIS 7 Programmer's Manual  7.0.3(2016)-r00000
trim_dec.c
Go to the documentation of this file.
1 
14 #include <string.h>
15 #include <grass/gis.h>
16 
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 }
void G_trim_decimal(char *buf)
Removes trailing zeros from decimal number.
Definition: trim_dec.c:24