GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-d6dec75dd4
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 36 of file commas.c.

References strcpy.

◆ 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 85 of file commas.c.

References b.