PostGIS  2.2.7dev-r@@SVN_REVISION@@
void trim_trailing_zeros ( char *  str)

Definition at line 224 of file lwutil.c.

References LWDEBUGF.

Referenced by assvg_point_buf(), pointArray_svg_abs(), pointArray_svg_rel(), pointArray_to_geojson(), pointArray_toGML2(), pointArray_toGML3(), and pointArray_toX3D3().

225 {
226  char *ptr, *totrim=NULL;
227  int len;
228  int i;
229 
230  LWDEBUGF(3, "input: %s", str);
231 
232  ptr = strchr(str, '.');
233  if ( ! ptr ) return; /* no dot, no decimal digits */
234 
235  LWDEBUGF(3, "ptr: %s", ptr);
236 
237  len = strlen(ptr);
238  for (i=len-1; i; i--)
239  {
240  if ( ptr[i] != '0' ) break;
241  totrim=&ptr[i];
242  }
243  if ( totrim )
244  {
245  if ( ptr == totrim-1 ) *ptr = '\0';
246  else *totrim = '\0';
247  }
248 
249  LWDEBUGF(3, "output: %s", str);
250 }
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55

Here is the caller graph for this function: