GRASS GIS 7 Programmer's Manual  7.9.dev(2021)-e5379bbd7
commas.c File Reference

GIS Library - Comma string functions. More...

#include <string.h>
#include <grass/gis.h>
Include dependency graph for commas.c:

Go to the source code of this file.

Functions

int G_insert_commas (char *buf)
 Inserts commas into a number string. More...
 
void G_remove_commas (char *buf)
 Removes commas from number string. More...
 

Detailed Description

GIS Library - Comma string functions.

(C) 2001-2014 by the GRASS Development Team

This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.

Author
GRASS GIS Development Team
Date
1999-2014

Definition in file commas.c.

Function Documentation

◆ G_insert_commas()

int G_insert_commas ( char *  buf)

Inserts commas into a number string.

Examples:

  • 1234567 becomes 1,234,567
  • 1234567.89 becomes 1,234,567.89
  • 12345 becomes 12,345
  • 1234 stays 1234

Note: Does not work with negative numbers.

Parameters
[in,out]bufstring
Returns
1 if no commas inserted
0 if commas inserted

Definition at line 38 of file commas.c.

References color_name::number.

◆ G_remove_commas()

void G_remove_commas ( char *  buf)

Removes commas from number string.

Examples:

  • 1,234,567 becomes 1234567
  • 1,234,567.89 becomes 1234567.89
  • 12,345 becomes 12345
  • 1234 stays 1234
Parameters
[in,out]bufstring
Returns

Definition at line 88 of file commas.c.

References b.