Loading...
Searching...
No Matches
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.
void | G_remove_commas (char *buf)
| Removes commas from number string.

## 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 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] | buf | string

Returns
  1 if no commas inserted
  0 if commas inserted

Definition at line 35 of file commas.c.

References G_strlcpy().

## 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] | buf | string

Returns

Definition at line 83 of file commas.c.

References b.