GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-36359e2344
|
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 198 of file gis/token.c.
References G_free(), and NULL.
Referenced by check_create_export_opts(), check_create_import_opts(), 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 179 of file gis/token.c.
References NULL.
Referenced by G_set_keywords(), 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 47 of file gis/token.c.
Referenced by check_create_export_opts(), check_create_import_opts(), check_mapset_in_layer_name(), G_set_keywords(), 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 83 of file gis/token.c.