GRASS Programmer's Manual
6.5.svn(2014)-r66266
|
GIS Library - string/chring movement functions. More...
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <sys/types.h>
#include <grass/gis.h>
Go to the source code of this file.
Macros | |
#define | NULL 0 |
Functions | |
char * | G_strcpy (char *T, const char *F) |
Copies characters from the string F into the string T. More... | |
char * | G_chrcpy (char *T, const char *F, int n) |
Copies characters from the string F into the string T. More... | |
char * | G_strncpy (char *T, const char *F, int n) |
This function is similar to G_chrcpy() but always copies at least n characters into the string T. More... | |
char * | G_strmov (char *T, const char *F) |
Copies characters from the string F (not including the terminating null character) into the string T. More... | |
char * | G_chrmov (char *T, const char *F, int n) |
This copies characters from the string F (exactly n characters) into the string T. More... | |
char * | G_strcat (char *T, const char *F) |
This copies characters from the string F into the string T. More... | |
char * | G_chrcat (char *T, const char *F, int n) |
This function is like G_strcat() except that not more than n characters from F are appended to the end of T. More... | |
int | G_strcasecmp (const char *x, const char *y) |
String compare ignoring case (upper or lower) More... | |
char * | G_strstr (const char *mainString, const char *subString) |
Finds the first occurrence of the character C in the null-terminated string beginning at mainString. More... | |
char * | G_strdup (const char *string) |
Copies the null-terminated string into a newly allocated string. The string is allocated using G_malloc(). More... | |
char * | G_strchg (char *bug, char character, char new) |
Replace all occurencies of character in string bug with new. More... | |
char * | G_str_replace (char *buffer, const char *old_str, const char *new_str) |
Replace all occurencies of old_str in buffer with new_str. More... | |
int | G_strip (char *buf) |
Removes all leading and trailing white space from string. More... | |
char * | G_chop (char *line) |
Chop leading and trailing white spaces: More... | |
void | G_str_to_upper (char *str) |
Convert string to upper case. More... | |
void | G_str_to_lower (char *str) |
Convert string to lower case. More... | |
int | G_str_to_sql (char *str) |
Make string SQL compliant. More... | |
GIS Library - string/chring movement functions.
(C) 1999-2008 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 strings.c.
char* G_chop | ( | char * | line | ) |
Chop leading and trailing white spaces:
space, \f, \n, \r, \t, \v
modified copy of G_squeeze(); RB March 2000 Radim .Bla zek@d hv.c z
line | buffer to be worked on |
Definition at line 418 of file strings.c.
Referenced by dig_read_frmt_ascii(), G_parse_color_rule(), G_str_to_color(), get_key_data(), read_coor(), read_file(), S_read(), Vect_get_column_names(), Vect_get_column_names_types(), Vect_get_column_types(), and Vect_read_dblinks().
char* G_chrcat | ( | char * | T, |
const char * | F, | ||
int | n | ||
) |
This function is like G_strcat() except that not more than n characters from F are appended to the end of T.
This function is similar to G_strcpy(), except that the characters from F are concatenated or appended to the end of T, instead of overwriting it. That is, the first character from F overwrites the null character marking the end of T.
[out] | T | target string |
[in] | F | source string |
[in] | n | number of character to copy |
Definition at line 174 of file strings.c.
References G_chrcpy().
char* G_chrcpy | ( | char * | T, |
const char * | F, | ||
int | n | ||
) |
Copies characters from the string F into the string T.
Copies just the first n characters from the string F. At the end the null terminator is written into the string T.
[out] | T | target string |
[in] | F | source string |
[in] | n | number of characters to copy |
Definition at line 66 of file strings.c.
Referenced by G_chrcat().
char* G_chrmov | ( | char * | T, |
const char * | F, | ||
int | n | ||
) |
char* G_str_replace | ( | char * | buffer, |
const char * | old_str, | ||
const char * | new_str | ||
) |
Replace all occurencies of old_str in buffer with new_str.
Code example:
[in,out] | buffer | main string |
[in] | old_str | string to replace |
[in] | new_str | new string |
Definition at line 316 of file strings.c.
References count, G_strdup(), G_strstr(), N, and NULL.
Referenced by db_read_dbmscap(), escape_tcl_string(), and Vect_subst_var().
void G_str_to_lower | ( | char * | str | ) |
int G_str_to_sql | ( | char * | str | ) |
void G_str_to_upper | ( | char * | str | ) |
int G_strcasecmp | ( | const char * | x, |
const char * | y | ||
) |
String compare ignoring case (upper or lower)
Returning a value that has the same sign as the difference between the first differing pair of characters
[in] | x | first string to compare |
[in] | y | second string to compare |
Definition at line 192 of file strings.c.
Referenced by class_apply_algorithm(), clean_dir(), D_translate_color(), db__copy_table(), db_get_column(), db_table_exists(), dig_file_load(), dig_read_frmt_ascii(), F_generate(), G_ask_datum_name(), G_basename(), G_get_datum_by_name(), G_get_ellipsoid_by_name(), G_get_spheroid_by_name(), G_info_format(), G_parse_color_rule(), G_str_to_color(), GPJ_ask_datum_params(), GPJ_get_datum_by_name(), GPJ_get_datum_transform_by_name(), GPJ_get_ellipsoid_by_name(), GPJ_grass_to_osr(), GPJ_osr_to_grass(), LOC_open_driver(), PNG_Graph_set(), PS_Graph_set(), read_image(), S_read(), submit(), Vect_legal_filename(), and write_image().
char* G_strcat | ( | char * | T, |
const char * | F | ||
) |
This copies characters from the string F into the string T.
This function is similar to G_strcpy(), except that the characters from F are concatenated or appended to the end of T, instead of overwriting it. That is, the first character from F overwrites the null character marking the end of T.
[out] | T | target string |
[in] | F | source string |
Definition at line 153 of file strings.c.
References G_strcpy().
Referenced by G_site_format(), and read_ellipsoid_table().
char* G_strchg | ( | char * | bug, |
char | character, | ||
char | new | ||
) |
char* G_strcpy | ( | char * | T, |
const char * | F | ||
) |
Copies characters from the string F into the string T.
This function has undefined results if the strings overlap.
[out] | T | target string |
[in] | F | source string |
Definition at line 46 of file strings.c.
Referenced by G_site_format(), G_str_to_color(), G_strcat(), GVL_get_volname(), and GVL_isosurf_get_att().
char* G_strdup | ( | const char * | string | ) |
Copies the null-terminated string into a newly allocated string. The string is allocated using G_malloc().
[in] | string | the string to duplicate |
Definition at line 265 of file strings.c.
References NULL.
Referenced by F_generate(), and G_str_replace().
int G_strip | ( | char * | buf | ) |
Removes all leading and trailing white space from string.
[in,out] | buf | buffer to be worked on |
Definition at line 389 of file strings.c.
References b.
Referenced by E_edit_cats(), E_edit_cellhd(), E_edit_fp_cats(), E_edit_history(), G3d_keyGetString(), G3d_keyGetValue(), G__check_fp_type(), G__read_cats(), G_ask_colors(), G_ask_datum_name(), G_ask_ellipse_name(), G_ask_proj_name(), G_fread_key_value(), G_get_cell_title(), G_get_dig_title(), G_put_cell_title(), G_read_color_rule(), G_set_d_raster_cat(), G_set_raster_cats_fmt(), G_set_raster_cats_title(), G_yes(), GPJ_ask_datum_params(), GPJ_get_datum_transform_by_name(), I_read_one_signature(), I_read_signatures(), main(), make_location(), read_datum_table(), and read_ellipsoid_table().
char* G_strmov | ( | char * | T, |
const char * | F | ||
) |
char* G_strncpy | ( | char * | T, |
const char * | F, | ||
int | n | ||
) |
This function is similar to G_chrcpy() but always copies at least n characters into the string T.
If the length of F is more than n, then copies just the first n characters. At the end the null terminator is written into the string T.
[out] | T | target string |
[in] | F | source string |
[in] | n | number of characters to copy |
Definition at line 90 of file strings.c.
Referenced by G__oldsite_get(), and G_site_get().
char* G_strstr | ( | const char * | mainString, |
const char * | subString | ||
) |
Finds the first occurrence of the character C in the null-terminated string beginning at mainString.
[in] | mainString | string where to find sub-string |
[in] | subString | sub-string |
Definition at line 230 of file strings.c.
References NULL, and forms::q.
Referenced by db_read_dbmscap(), G_oldsite_describe(), G_str_replace(), and GPJ_grass_to_osr().