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

Definition at line 252 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().

253 {
254  char *ptr, *totrim=NULL;
255  int len;
256  int i;
257 
258  LWDEBUGF(3, "input: %s", str);
259 
260  ptr = strchr(str, '.');
261  if ( ! ptr ) return; /* no dot, no decimal digits */
262 
263  LWDEBUGF(3, "ptr: %s", ptr);
264 
265  len = strlen(ptr);
266  for (i=len-1; i; i--)
267  {
268  if ( ptr[i] != '0' ) break;
269  totrim=&ptr[i];
270  }
271  if ( totrim )
272  {
273  if ( ptr == totrim-1 ) *ptr = '\0';
274  else *totrim = '\0';
275  }
276 
277  LWDEBUGF(3, "output: %s", str);
278 }
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88

Here is the caller graph for this function: