GRASS Programmer's Manual 6.4.1(2011)
|
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.
Defines | |
#define | NULL 0 |
Functions | |
char * | G_strcpy (char *T, const char *F) |
Copies characters from the string F into the string T. | |
char * | G_chrcpy (char *T, const char *F, int n) |
Copies characters from the string F into the string T. | |
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. | |
char * | G_strmov (char *T, const char *F) |
Copies characters from the string F (not including the terminating null character) into the string T. | |
char * | G_chrmov (char *T, const char *F, int n) |
This copies characters from the string F (exactly n characters) into the string T. | |
char * | G_strcat (char *T, const char *F) |
This copies characters from the string F into the string T. | |
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. | |
int | G_strcasecmp (const char *x, const char *y) |
String compare ignoring case (upper or lower) | |
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. | |
char * | G_strdup (const char *string) |
Copies the null-terminated string into a newly allocated string. The string is allocated using G_malloc(). | |
char * | G_strchg (char *bug, char character, char new) |
Replace all occurencies of character in string bug with new. | |
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. | |
int | G_strip (char *buf) |
Removes all leading and trailing white space from string. | |
char * | G_chop (char *line) |
Chop leading and trailing white spaces: | |
void | G_str_to_upper (char *str) |
Convert string to upper case. | |
void | G_str_to_lower (char *str) |
Convert string to lower case. | |
int | G_str_to_sql (char *str) |
Make string SQL compliant. |
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.
#define NULL 0 |
Definition at line 26 of file strings.c.
Referenced by G__check_fp_type(), G__color_free_rules(), G__create_alt_env(), G__env_name(), G__get_window(), G__lookup_colors(), G__ls(), G__make_location(), G__make_mapset(), G__mapset_name(), G__open_cell_old(), G__projection_name(), G__quant_get_rule_for_d_raster_val(), G__raster_misc_read_line(), G__raster_misc_write_line(), G__read_Cell_head_array(), G__set_gisrc_file(), G__temp_element(), G__unit_name(), G__write_cats(), G_adjust_Cell_head(), G_adjust_Cell_head3(), G_ask_any(), G_ask_datum_name(), G_ask_ellipse_name(), G_ask_in_mapset(), G_ask_new(), G_ask_new_file(), G_ask_old(), G_ask_old_file(), G_ask_proj_name(), G_available_mapsets(), G_check_input_output_name(), G_color_name(), G_compare_projections(), G_copy_file(), G_create_key_value(), G_database_datum_name(), G_database_units_to_meters_factor(), G_datum_description(), G_datum_ellipsoid(), G_datum_name(), G_debug(), G_define_flag(), G_define_option(), G_ellipsoid_description(), G_ellipsoid_name(), G_find_file(), G_find_file2(), G_find_key_value(), G_fread_key_value(), G_free_histogram(), G_free_raster_cats(), G_free_reclass(), G_free_tokens(), G_get_3dview(), G_get_ask_return_msg(), G_get_cellhd(), G_get_datumparams_from_projinfo(), G_get_ellipsoid_parameters(), G_get_gdal_link(), G_get_next_marked_d_raster_cat(), G_get_projinfo(), G_get_projunits(), G_get_raster_cat(), G_get_reclass(), G_getenv(), G_getenv2(), G_gishelp(), G_home(), G_index(), G_init_colors(), G_init_histogram(), G_init_raster_cats(), G_is_reclass(), G_is_reclassed_to(), G_list(), G_make_random_colors(), G_mapset(), G_number_of_tokens(), G_parser(), G_percent2(), G_plot_area(), G_put_3dview(), G_put_reclass(), G_putenv(), G_rc_path(), G_read_color_rules(), G_read_histogram(), G_read_history(), G_read_key_value_file(), G_read_range(), G_recreate_command(), G_remove(), G_rindex(), G_set_d_raster_cat(), G_set_key_value(), G_set_raster_cats_title(), G_spawn(), G_str_replace(), G_strdup(), G_strstr(), G_system(), G_tokenize(), G_usage(), G_vasprintf(), G_whoami(), G_write_histogram(), G_write_histogram_cs(), and G_write_key_value_file().
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.Blazek@dhv.cz>
line | buffer to be worked on |
Definition at line 418 of file strings.c.
Referenced by G_parse_color_rule(), and G_str_to_color().
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 | ||
) |
This copies characters from the string F (exactly n characters) into the string T.
The terminating null character is not explicitly written into the string T.
[out] | T | target string |
[in] | F | source string |
[in] | n | number of characters to copy |
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:
char *name; name = G_str_replace ( inbuf, ".exe", "" ); ... G_free (name);
[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 B, G_strdup(), G_strstr(), and NULL.
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 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(), and G_str_to_color().
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().
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_str_to_color(), and G_strcat().
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 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 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(), and G_yes().
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 |
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.
Referenced by G_str_replace().