GRASS GIS 8 Programmer's Manual
8.2.2dev(2023)-3d2c704037
|
GIS Library - Tokenize strings. More...
Go to the source code of this file.
Functions | |
char ** | G_tokenize (const char *buf, const char *delim) |
Tokenize string. More... | |
char ** | G_tokenize2 (const char *buf, const char *delim, const char *valchar) |
Tokenize string. More... | |
int | G_number_of_tokens (char **tokens) |
Return number of tokens. More... | |
void | G_free_tokens (char **tokens) |
Free memory allocated to tokens. More... | |
GIS Library - Tokenize strings.
(C) 2001-2008, 2011-2013 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.
Definition in file gis/token.c.
void G_free_tokens | ( | char ** | tokens | ) |
Free memory allocated to tokens.
Note: G_free_tokens() must be called when finished with tokens to release memory.
[out] | tokens |
Definition at line 204 of file gis/token.c.
References G_free(), and NULL.
Referenced by check_create_export_opts(), check_create_import_opts(), GPJ_grass_to_osr2(), V1_close_ogr(), and Vect__open_cursor_next_line_pg().
int G_number_of_tokens | ( | char ** | tokens | ) |
Return number of tokens.
tokens |
Definition at line 185 of file gis/token.c.
References NULL.
Referenced by G_set_keywords(), GPJ_grass_to_osr2(), and Vect__open_cursor_next_line_pg().
char** G_tokenize | ( | const char * | buf, |
const char * | delim | ||
) |
Tokenize string.
Given a string, buf, turn delimiter, delim, into '\0' (NULL) and place pointers to tokens in tokens. buf must not contain a new line (
). delim may consist of more than one character. G_free_tokens() must be called when finished with tokens to release memory.
Example:
buf | input string |
delim | string delimiter |
Definition at line 48 of file gis/token.c.
Referenced by check_create_export_opts(), check_create_import_opts(), check_mapset_in_layer_name(), G_set_keywords(), GPJ_grass_to_osr2(), and Vect__open_cursor_next_line_pg().
char** G_tokenize2 | ( | const char * | buf, |
const char * | delim, | ||
const char * | valchar | ||
) |
Tokenize string.
This function behaves similarly to G_tokenize().
It introduces valchar which defines borders of token. Within token delim is ignored.
Example:
In this example ntok1 will be 4, ntok2 only 3, i.e. { "a", "'b, c'", "d"}
buf | input string |
delim | string delimiter |
valchar | character defining border of token |
Definition at line 84 of file gis/token.c.